DAFS: Do not record vol ops for DELETED vols
authorAndrew Deason <adeason@sinenomine.net>
Wed, 23 Mar 2011 21:46:47 +0000 (16:46 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 24 Mar 2011 16:22:01 +0000 (09:22 -0700)
When a volume is VOL_STATE_DELETED, it effectively does not exist, so
there is little point in recording a vp->pending_vol_op structure for
it. Just let callers checkout the volume as they would a nonexistent
volume: without recording anything about the operation.

This just reduces some edge cases and confusing debugging info, so we
don't have to worry about cleaning up pending_vol_op structures for
nonexistent volumes.

Change-Id: I56b92c3f2548ea48f9c61100be07edf9f7277fee
Reviewed-on: http://gerrit.openafs.org/4296
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vol/fssync-server.c

index d163442..a5786b7 100644 (file)
@@ -980,7 +980,6 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res)
        case VOL_STATE_PREATTACHED:
        case VOL_STATE_SALVAGING:
        case VOL_STATE_ERROR:
-       case VOL_STATE_DELETED:
            /* register the volume operation metadata with the volume
             *
             * if the volume is currently pre-attached, attach2()
@@ -988,6 +987,9 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res)
             * attaching the volume would be safe */
            VRegisterVolOp_r(vp, &info);
            vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningUnknown;
+           /* fall through */
+
+       case VOL_STATE_DELETED:
            goto done;
        default:
            break;
@@ -1008,7 +1010,6 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res)
             case VOL_STATE_PREATTACHED:
             case VOL_STATE_SALVAGING:
             case VOL_STATE_ERROR:
-            case VOL_STATE_DELETED:
                 /* register the volume operation metadata with the volume
                  *
                  * if the volume is currently pre-attached, attach2()
@@ -1016,6 +1017,9 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res)
                  * attaching the volume would be safe */
                 VRegisterVolOp_r(vp, &info);
                 vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningUnknown;
+               /* fall through */
+
+            case VOL_STATE_DELETED:
                 goto done;
             default:
                 break;