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.

Change-Id: I9d91db98387b7aaa986ed915420c6cafb4f12438
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>
This commit is contained in:
Michael Meffie 2016-02-25 18:49:20 -05:00 committed by Benjamin Kaduk
parent 3609ebcfa3
commit 961875cbed

View 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 */