}
/* called with cm_scacheLock and scp write-locked */
-void cm_ResetSCacheDirectory(cm_scache_t *scp)
+void cm_ResetSCacheDirectory(cm_scache_t *scp, afs_int32 dirlock)
{
#ifdef USE_BPLUS
/* destroy directory Bplus Tree */
if (scp->dirBplus) {
LARGE_INTEGER start, end;
+
+ if (!dirlock && !lock_TryWrite(&scp->dirlock)) {
+ /*
+ * We are not holding the dirlock and obtaining it
+ * requires that we drop the scp->rw. As a result
+ * we will leave the dirBplus tree intact but
+ * invalidate the version number so that whatever
+ * operation is currently active can safely complete
+ * but the contents will be ignored on the next
+ * directory operation.
+ */
+ scp->dirDataVersion = CM_SCACHE_VERSION_BAD;
+ return;
+ }
+
QueryPerformanceCounter(&start);
bplus_free_tree++;
freeBtree(scp->dirBplus);
scp->dirBplus = NULL;
+ scp->dirDataVersion = CM_SCACHE_VERSION_BAD;
QueryPerformanceCounter(&end);
+
+ if (!dirlock)
+ lock_ReleaseWrite(&scp->dirlock);
bplus_free_time += (end.QuadPart - start.QuadPart);
}
*/
cm_FreeAllACLEnts(scp);
- cm_ResetSCacheDirectory(scp);
+ cm_ResetSCacheDirectory(scp, 0);
return 0;
}
void cm_MergeStatus(cm_scache_t *dscp,
cm_scache_t *scp, AFSFetchStatus *statusp,
AFSVolSync *volsyncp,
- cm_user_t *userp, afs_uint32 flags)
+ cm_user_t *userp, cm_req_t *reqp, afs_uint32 flags)
{
afs_uint64 dataVersion;
cellp = cm_FindCellByID(scp->fid.cell, 0);
if (scp->cbServerp) {
struct cm_volume *volp = NULL;
-
cm_FindVolumeByID(cellp, scp->fid.volume, userp,
- (cm_req_t *) NULL, CM_GETVOL_FLAG_CREATE, &volp);
+ reqp, CM_GETVOL_FLAG_CREATE, &volp);
osi_Log2(afsd_logp, "old data from server %x volume %s",
scp->cbServerp->addr.sin_addr.s_addr,
volp ? volp->namep : "(unknown)");