From 8265c8652e00d0a0b579bd48efeff4d60872e17f Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 21 Jun 2011 14:58:42 -0500 Subject: [PATCH] vol: Do not overwrite specialStatus in attach2 attach2 wants to set specialStatus to VBUSY in certain conditions (such as, it discovers a conflicting vol op where VVolOpSetVBusy_r is true). However, specialStatus may already be set to something else, like VMOVED if the volume is being moved off of the server. This can happen if the volserver has checked out and FSYNC_VOL_MOVE'd a preattached volume but hasn't deleted or checked the volume back in yet. So, if specialStatus is already set, don't touch it, so we don't start reporting VBUSY errors to clients when we should be reporting VMOVED, or some other error code previously set. Reviewed-on: http://gerrit.openafs.org/4873 Reviewed-by: Derrick Brashear Tested-by: BuildBot (cherry picked from commit 25688bc2e7e8da83b4bf22d7cdc3e0214eadc455) Change-Id: I4316be912a5a30856914059984f45782bece0cdd Reviewed-on: http://gerrit.openafs.org/4942 Tested-by: Andrew Deason Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/vol/volume.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vol/volume.c b/src/vol/volume.c index f99c0a338..e330b1026 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -3027,7 +3027,11 @@ attach_check_vop(Error *ec, VolumeId volid, struct DiskPartition64 *partp, /* check to see if we should set the specialStatus flag */ if (VVolOpSetVBusy_r(vp, vp->pending_vol_op)) { - vp->specialStatus = VBUSY; + /* don't overwrite specialStatus if it was already set to + * something else (e.g. VMOVED) */ + if (!vp->specialStatus) { + vp->specialStatus = VBUSY; + } } break; @@ -3112,7 +3116,11 @@ attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp, if (!*ec) { read_header = 1; - vp->specialStatus = (byte) (isbusy ? VBUSY : 0); + /* ensure that we don't override specialStatus if it was set to + * something else (e.g. VMOVED) */ + if (isbusy && !vp->specialStatus) { + vp->specialStatus = VBUSY; + } vp->shuttingDown = 0; vp->goingOffline = 0; vp->nUsers = 1; -- 2.39.5