From a18175f479437f3a4fe68460538927630070cd13 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 16 Mar 2011 11:48:08 -0500 Subject: [PATCH] DAFS: DFlushVolume outside of vol glock DFlushVolume may traverse a long list of directory objects, and can even hit the disk, so we should drop the glock for it. This should be safe in DAFS, since we already transition the volume to an exclusive state before doing this, and DFlushVolume only deals with structures internal to the directory package and maintains its own locking. Change-Id: I6493042c8f36614b55d4dc40d97639e56b34fabd Reviewed-on: http://gerrit.openafs.org/4242 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vol/volume.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/vol/volume.c b/src/vol/volume.c index 0c4f359b9..978c8e172 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -4726,15 +4726,17 @@ VCloseVolumeHandles_r(Volume * vp) VolState state_save; state_save = VChangeState_r(vp, VOL_STATE_OFFLINING); + + VOL_UNLOCK; #endif - /* demand attach fs - * - * XXX need to investigate whether we can perform - * DFlushVolume outside of vol_glock_mutex... - * - * VCloseVnodeFiles_r drops the glock internally */ DFlushVolume(vp->hashid); + +#ifdef AFS_DEMAND_ATTACH_FS + VOL_LOCK; +#endif + + /* DAFS: VCloseVnodeFiles_r drops the glock internally */ VCloseVnodeFiles_r(vp); #ifdef AFS_DEMAND_ATTACH_FS @@ -4778,13 +4780,17 @@ VReleaseVolumeHandles_r(Volume * vp) VolState state_save; state_save = VChangeState_r(vp, VOL_STATE_DETACHING); + + VOL_UNLOCK; #endif - /* XXX need to investigate whether we can perform - * DFlushVolume outside of vol_glock_mutex... */ DFlushVolume(vp->hashid); - VReleaseVnodeFiles_r(vp); /* releases the glock internally */ +#ifdef AFS_DEMAND_ATTACH_FS + VOL_LOCK; +#endif + + VReleaseVnodeFiles_r(vp); /* DAFS: releases the glock internally */ #ifdef AFS_DEMAND_ATTACH_FS VOL_UNLOCK; -- 2.39.5