diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index e6d2590b2d..1b22812c2f 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -235,15 +235,13 @@ afs_Daemon(void) if (afsd_dynamic_vcaches && (last5MinCheck + 300 < now)) { /* start with trying to drop us back to our base usage */ - int anumber; - if (afs_vcount <= afs_cacheStats) - anumber = VCACHE_FREE; - else - anumber = VCACHE_FREE + (afs_vcount - afs_cacheStats); + int anumber = VCACHE_FREE + (afs_vcount - afs_cacheStats); - ObtainWriteLock(&afs_xvcache, 734); - afs_ShakeLooseVCaches(anumber); - ReleaseWriteLock(&afs_xvcache); + if (anumber > 0) { + ObtainWriteLock(&afs_xvcache, 734); + afs_ShakeLooseVCaches(anumber); + ReleaseWriteLock(&afs_xvcache); + } last5MinCheck = now; }