]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: hold vcache while dropping dcache refs
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 25 Feb 2016 23:49:20 +0000 (18:49 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 14 Apr 2016 11:02:58 +0000 (07:02 -0400)
Hold a reference on a vcache while attempting to evict the inode from
the dcache. Since the afs_xvcache lock is dropped, it could be possible
for the vcache to be flushed during this time, making it unsafe to use
the vcache after the eviction attempt.

Reviewed-on: https://gerrit.openafs.org/12206
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@dson.org>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 961875cbedc2c91cdba6dc34a43c6136ea9797fb)

Change-Id: I5beea5798f6cb10a00db90e1ba18dbc7ab1e43cb
Reviewed-on: https://gerrit.openafs.org/12256
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/LINUX/osi_vcache.c

index e64265f76da80b21f729572463cfd5163f1d8e1a..8a0c57899852e17843a4362ad0f3400495c27b42 100644 (file)
@@ -28,6 +28,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) {
     /* First, see if we can evict the inode from the dcache */
     if (defersleep && avc != afs_globalVp && VREFCOUNT(avc) > 1 && avc->opens == 0) {
        *slept = 1;
+       AFS_FAST_HOLD(avc);
        ReleaseWriteLock(&afs_xvcache);
         AFS_GUNLOCK();
 
@@ -87,6 +88,7 @@ restart:
 inuse:
        AFS_GLOCK();
        ObtainWriteLock(&afs_xvcache, 733);
+       AFS_FAST_RELE(avc);
     }
 
     /* See if we can evict it from the VLRUQ */