]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DAFS: Avoid unnecessary preattach on FSYNC_VOL_ON
authorAndrew Deason <adeason@sinenomine.net>
Wed, 30 Nov 2011 23:35:56 +0000 (17:35 -0600)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Dec 2011 11:55:11 +0000 (03:55 -0800)
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.

Reviewed-on: http://gerrit.openafs.org/6167
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d5d2d00a47cf53054bd18d7404be26bea34cba6f)

Change-Id: I2a7f4b214176570e787978dbe0aa2eb8dc57730f
Reviewed-on: http://gerrit.openafs.org/6323
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
src/vol/fssync-server.c

index f5b915e991ab524be18f467b472b8e04cb0f206e..a9ba3789b2dd0143807a5b963cb8108f516d7f08 100644 (file)
@@ -771,10 +771,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);