disconnected-clear-cstatd-on-reconnect-20090125
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Sun, 25 Jan 2009 14:48:14 +0000 (14:48 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 25 Jan 2009 14:48:14 +0000 (14:48 +0000)
LICENSE IPL10
FIXES 124180

don't treat any information we forged as being valid while offline as valid

src/afs/afs_disconnected.c
src/afs/afs_pioctl.c
src/afs/afs_prototypes.h
src/afs/afs_vcache.c

index 966d729..9a6bf6d 100644 (file)
@@ -821,14 +821,6 @@ int afs_ProcessOpCreate(struct vcache *avc,
     /* Now we can set the new fid. */
     memcpy(&avc->fid, &newFid, sizeof(struct VenusFid));
 
-    if (tdp) {
-       /* Unset parent dir CStat flag, so it will get refreshed on next
-        * online stat.
-        */
-       ObtainWriteLock(&tdp->lock, 745);
-       tdp->states &= ~CStatd;
-       ReleaseWriteLock(&tdp->lock);
-    }
 end:
     if (tdp)
        afs_PutVCache(tdp);
@@ -944,16 +936,6 @@ int afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq)
     if (code)
        printf("afs_ProcessOpRemove: server returned code=%u\n", code);
 
-    /* Remove the statd flag from parent dir's vcache. */
-    ObtainSharedLock(&afs_xvcache, 761);
-    tdp = afs_FindVCache(&pdir_fid, 0, 1);
-    ReleaseSharedLock(&afs_xvcache);
-    if (tdp) {
-       ObtainWriteLock(&tdp->lock, 746);
-       tdp->states &= ~CStatd;
-       ReleaseWriteLock(&tdp->lock);
-       afs_PutVCache(tdp);
-    }
 end:
     afs_osi_Free(tname, AFSNAMEMAX);
     return code;
index 4453dd2..23fd946 100644 (file)
@@ -4701,6 +4701,7 @@ DECL_PIOCTL(PDiscon)
                afs_is_discon_rw = 0;
                printf("\nSync succeeded. You are back online.\n");
            }
+           afs_ClearAllStatdFlag();
 
            ReleaseWriteLock(&afs_discon_lock);
            break;
index afc12d7..86c5564 100644 (file)
@@ -1003,7 +1003,7 @@ extern afs_int32 afs_NFSFindVCache(struct vcache **avcp,
 extern void afs_vcacheInit(int astatSize);
 extern void shutdown_vcache(void);
 extern void afs_DisconGiveUpCallbacks(void);
-
+extern void afs_ClearAllStatdFlag(void);
 
 /* VNOPS/afs_vnop_access.c */
 extern afs_int32 afs_GetAccessBits(register struct vcache *avc,
index 511dfa6..fef5668 100644 (file)
@@ -3282,7 +3282,6 @@ shutdown_vcache(void)
        QInit(&afs_vhashTV[i]);
 }
 
-#ifdef AFS_DISCON_ENV
 void afs_DisconGiveUpCallbacks() {
     int i;
     struct vcache *tvc;
@@ -3307,4 +3306,25 @@ void afs_DisconGiveUpCallbacks() {
     /*printf("gone\n");*/
 }
 
-#endif
+/*!
+ *
+ * Clear the Statd flag from all vcaches
+ *
+ * This function removes the Statd flag from all vcaches. It's used by 
+ * disconnected mode to tidy up during reconnection
+ *
+ */
+void afs_ClearAllStatdFlag() {
+    int i;
+    struct vcache *tvc;
+   
+    ObtainWriteLock(&afs_xvcache, 715);
+
+    for (i = 0; i < VCSIZE; i++) {
+       for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
+           tvc->states &= ~(CStatd|CUnique);
+       }
+    }
+    ReleaseWriteLock(&afs_xvcache);
+}
+