]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-abstract-reset-vcache-20090119
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Mon, 19 Jan 2009 19:39:22 +0000 (19:39 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 19 Jan 2009 19:39:22 +0000 (19:39 +0000)
LICENSE IPL10
FIXES 124147

abstract vcache resetting code so disconnected can reuse it

(cherry picked from commit 57744971179a8ee7441e73eeb9e2a56d671fcc37)

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

index 8fa09cd5fc6c4bab912aa6aaa983e3a2af315165..a80d9218e9071fa88db4428bd2e52e04cc7bbc08 100644 (file)
@@ -1806,17 +1806,7 @@ DECL_PIOCTL(PFlush)
     afs_BozonLock(&avc->pvnLock, avc); /* Since afs_TryToSmush will do a pvn_vptrunc */
 #endif
     ObtainWriteLock(&avc->lock, 225);
-    ObtainWriteLock(&afs_xcbhash, 456);
-    afs_DequeueCallback(avc);
-    avc->states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */
-    ReleaseWriteLock(&afs_xcbhash);
-    /* now find the disk cache entries */
-    afs_TryToSmush(avc, *acred, 1);
-    osi_dnlc_purgedp(avc);
-    if (avc->linkData && !(avc->states & CCore)) {
-       afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
-       avc->linkData = NULL;
-    }
+    afs_ResetVCache(avc, *acred);
     ReleaseWriteLock(&avc->lock);
 #ifdef AFS_BOZONLOCK_ENV
     afs_BozonUnlock(&avc->pvnLock, avc);
index 1c060f384a396ff880cbcbef7103a26cbfa1026d..3e639058851a57bcad826f01c0353c879d566079 100644 (file)
@@ -986,6 +986,7 @@ extern int afs_RemoteLookup(register struct VenusFid *afid,
                            struct AFSCallBack *CallBackp,
                            struct server **serverp,
                            struct AFSVolSync *tsyncp);
+extern void afs_ResetVCache(struct vcache *, struct AFS_UCRED *);
 extern afs_int32 afs_NFSFindVCache(struct vcache **avcp,
                                   struct VenusFid *afid);
 extern void afs_vcacheInit(int astatSize);
index 68d9145de7b3b4491428ba5ad9ab0e72561be2d1..3b75118147e5c1fed276d623eb2a114ab13b6a93 100644 (file)
@@ -2775,6 +2775,30 @@ afs_PutVCache(register struct vcache *avc)
 }                              /*afs_PutVCache */
 
 
+/*!
+ * Reset a vcache entry, so local contents are ignored, and the
+ * server will be reconsulted next time the vcache is used
+ * 
+ * \param avc Pointer to the cache entry to reset
+ * \param acred 
+ *
+ * \note avc must be write locked on entry
+ */
+void 
+afs_ResetVCache(struct vcache *avc, struct AFS_UCRED *acred) {
+    ObtainWriteLock(&afs_xcbhash, 456);
+    afs_DequeueCallback(avc);
+    avc->states &= ~(CStatd | CDirty); /* next reference will re-stat */
+    ReleaseWriteLock(&afs_xcbhash);
+    /* now find the disk cache entries */
+    afs_TryToSmush(avc, acred, 1);
+    osi_dnlc_purgedp(avc);
+    if (avc->linkData && !(avc->states & CCore)) {
+       afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
+       avc->linkData = NULL;
+    }
+}
+
 /*!
  * Sleepa when searching for a vcache. Releases all the pending locks,
  * sleeps then obtains the previously released locks.