From: Andrew Deason Date: Wed, 30 Nov 2011 23:35:56 +0000 (-0600) Subject: DAFS: Avoid unnecessary preattach on FSYNC_VOL_ON X-Git-Tag: openafs-stable-1_8_0pre1~2980 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=d5d2d00a47cf53054bd18d7404be26bea34cba6f DAFS: Avoid unnecessary preattach on FSYNC_VOL_ON FSYNC_VOL_ON/FSYNC_VOL_ATTACH can be called to "online" a volume that was actually kept online for the duration of the volume operation. Avoid calling VPreAttachVolumeByVp_r for such a volume if it's already attached, in order to avoid an unnecessary log message and to save a tiny bit of processing. Change-Id: I7776b933599ec0488941ccbd9a8e1279f5a552f4 Reviewed-on: http://gerrit.openafs.org/6167 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index d8f274c..14d2247 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -751,10 +751,25 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res) } #ifdef AFS_DEMAND_ATTACH_FS - /* first, check to see whether we have such a volume defined */ - vp = VPreAttachVolumeById_r(&error, - vcom->vop->partName, - vcom->vop->volume); + + if (vp && + FSYNC_partMatch(vcom, vp, 0) && + vp->pending_vol_op && + vp->pending_vol_op->vol_op_state == FSSYNC_VolOpRunningOnline && + V_attachState(vp) == VOL_STATE_ATTACHED) { + + /* noop; the volume stayed online for the volume operation and we were + * simply told that the vol op is done. The vp we already have is fine, + * so avoid confusing volume routines with trying to preattach an + * attached volume. */ + + } else { + /* first, check to see whether we have such a volume defined */ + vp = VPreAttachVolumeById_r(&error, + vcom->vop->partName, + vcom->vop->volume); + } + if (vp) { VCreateReservation_r(vp); VWaitExclusiveState_r(vp);