From: Andrew Deason Date: Tue, 21 Jun 2011 19:58:42 +0000 (-0500) Subject: vol: Do not overwrite specialStatus in attach2 X-Git-Tag: openafs-devel-1_7_1~360 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=25688bc2e7e8da83b4bf22d7cdc3e0214eadc455 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. Change-Id: Icb2895036620f186230e1558b8bc04d18cc45c86 Reviewed-on: http://gerrit.openafs.org/4873 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/vol/volume.c b/src/vol/volume.c index f1e1bc8..b075e97 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -3029,7 +3029,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; @@ -3114,7 +3118,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;