diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 21cf93109c..db5f2a883c 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -127,6 +127,10 @@ afs_CheckServerDaemon(void) extern int vfs_context_ref; +/* This function always holds the GLOCK whilst it is running. The caller + * gets the GLOCK before invoking it, and afs_osi_Sleep drops the GLOCK + * whilst we are sleeping, and regains it when we're woken up. + */ void afs_Daemon(void) { @@ -219,7 +223,9 @@ afs_Daemon(void) else anumber = VCACHE_FREE + (afs_maxvcount - afs_cacheStats); + ObtainWriteLock(&afs_xvcache, 734); afs_ShakeLooseVCaches(anumber); + ReleaseWriteLock(&afs_xvcache); last5MinCheck = now; } diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 5d070943a5..6d69b07d6d 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -634,13 +634,6 @@ afs_ShakeLooseVCaches(afs_int32 anumber) struct afs_q *tq, *uq; int code, fv_slept; afs_int32 target = anumber; - int haveGlock = 1; - - /* Should probably deal better */ - if (!ISAFS_GLOCK()) { - haveGlock = 0; - AFS_GLOCK(); - } if (afsd_dynamic_vcaches || afs_vcount >= afs_maxvcount) { i = 0; @@ -723,8 +716,6 @@ restart: /* printf("recycled %d entries\n", target-anumber); */ - if (!haveGlock) - AFS_GUNLOCK(); #endif return 0; }