]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DAFS: Allow FSSYNC salvages on unknown volumes
authorAndrew Deason <adeason@sinenomine.net>
Tue, 29 Jun 2010 19:44:31 +0000 (14:44 -0500)
committerDerrick Brashear <shadow@dementia.org>
Fri, 2 Jul 2010 17:33:50 +0000 (10:33 -0700)
Allow salvage requests over FSSYNC (FORCE_ERROR with the FSYNC_SALVAGE
reason code) that are requested on volumes that we do not know to
exist. This can be helpful if a salvage is requested on a volume that
someone attempted to create but failed, indicating that a
partially-created volume may be in the way.

Log an additional message when we do this, as it should not be a
normal occurrence.

Change-Id: I6e1bbe35111a41c489fe85cad36e6a8a6f323a5a
Reviewed-on: http://gerrit.openafs.org/2285
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/fssync-server.c

index a652f21761517ce14a2369c7757b0d46b7523a54..f79f1e39a44a785f87b2da6a4cbfb42680f272dd 100644 (file)
@@ -1268,6 +1268,22 @@ FSYNC_com_VolError(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     }
 
     vp = VLookupVolume_r(&error, vcom->vop->volume, NULL);
+
+    if (!vp && vcom->hdr->reason == FSYNC_SALVAGE) {
+       /* The requested volume doesn't seem to exist. However, it is possible
+        * that this is triggered by trying to create or clone a volume that
+        * was prevented from succeeding by a half-created volume in the way.
+        * (e.g. we tried to create volume X, but volume X exists except that
+        * its .vol header was deleted for some reason) So, still try to
+        * a salvage for that volume ID. */
+
+       Log("FSYNC_com_VolError: attempting to schedule salvage for unknown "
+           "volume %lu part %s\n", afs_printable_uint32_lu(vcom->vop->volume),
+           vcom->vop->partName);
+       vp = VPreAttachVolumeById_r(&error, vcom->vop->partName,
+                                   vcom->vop->volume);
+    }
+
     if (vp) {
        if (FSYNC_partMatch(vcom, vp, 0)) {
            /* null out salvsync control state, as it's no longer relevant */