From 6b041b7cb0d29815495b2559f24f4ff4979eb129 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 29 Jun 2010 14:44:31 -0500 Subject: [PATCH] DAFS: Allow FSSYNC salvages on unknown volumes 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 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/vol/fssync-server.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index a652f21761..f79f1e39a4 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -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 */