From: Michael Meffie Date: Thu, 25 Feb 2016 23:49:20 +0000 (-0500) Subject: LINUX: hold vcache while dropping dcache refs X-Git-Tag: upstream/1.6.18^2~4 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=440b518e6045e7cf2cd587dde38d95a29886aee3;p=packages%2Fo%2Fopenafs.git LINUX: hold vcache while dropping dcache refs 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 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 961875cbedc2c91cdba6dc34a43c6136ea9797fb) Change-Id: I5beea5798f6cb10a00db90e1ba18dbc7ab1e43cb Reviewed-on: https://gerrit.openafs.org/12256 Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index e64265f76..8a0c57899 100644 --- a/src/afs/LINUX/osi_vcache.c +++ b/src/afs/LINUX/osi_vcache.c @@ -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 */