From 6975fcb202f2a599814ce9f26cda1999163050f8 Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Thu, 9 Nov 2006 23:02:32 +0000 Subject: [PATCH] inactivevcache-hold-lock-20061109 FIXES 42798 hold a lock while we are in InactiveVCache --- src/afs/afs_vcache.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 2c74d4b..72e40e5 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 -- 1.9.4