From: Chas Williams Date: Thu, 9 Nov 2006 23:03:15 +0000 (+0000) Subject: DEVEL15-inactivevcache-hold-lock-20061109 X-Git-Tag: openafs-devel-1_5_11~12 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=eb22d57fffedf7657261d95e3d1ae4f9a8e89021;p=packages%2Fo%2Fopenafs.git DEVEL15-inactivevcache-hold-lock-20061109 FIXES 42798 hold a lock while we are in InactiveVCache (cherry picked from commit 6975fcb202f2a599814ce9f26cda1999163050f8) --- diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 2c74d4b57..72e40e5a7 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -286,6 +286,7 @@ void afs_InactiveVCache(struct vcache *avc, struct AFS_UCRED *acred) { AFS_STATCNT(afs_inactive); + ObtainWriteLock(&avc->lock, 50); if (avc->states & CDirty) { /* we can't keep trying to push back dirty data forever. Give up. */ afs_InvalidateAllSegments(avc); /* turns off dirty bit */ @@ -295,11 +296,16 @@ afs_InactiveVCache(struct vcache *avc, struct AFS_UCRED *acred) if (avc->states & CUnlinked) { if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) { avc->states |= CUnlinkedDel; - return; + goto unlock; } + ReleaseWriteLock(&avc->lock); afs_remunlink(avc, 1); /* ignore any return code */ } + return; + unlock: + ReleaseWriteLock(&avc->lock); + return; } #endif