vol: A GOING_OFFLINE volume should yield VOFFLINE

Currently, GetVolume treats a volume in the VOL_STATE_GOING_OFFLINE
state the same as VOL_STATE_SHUTTING_DOWN, and so returns VNOVOL for a
GOING_OFFLINE volume, but these states are very different.

GOING_OFFLINE indicates that a volume should soon be in the UNATTACHED
state, so we should treat GOING_OFFLINE the same as UNATTACHED for
returning errors to the user. For UNATTACHED, we return specialStatus
if it's set, or VOFFLINE otherwise; so, just do the same for
GOING_OFFLINE.

Change-Id: Ia9500d2cfd90b8c15782a06025f39298810d0a99
Reviewed-on: http://gerrit.openafs.org/7290
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Andrew Deason 2012-04-27 12:59:25 -05:00 committed by Derrick Brashear
parent 868378cc00
commit d10f71d44f

View File

@ -4044,18 +4044,18 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint,
* - VOL_STATE_SHUTTING_DOWN
*/
if ((V_attachState(vp) == VOL_STATE_ERROR) ||
(V_attachState(vp) == VOL_STATE_SHUTTING_DOWN) ||
(V_attachState(vp) == VOL_STATE_GOING_OFFLINE)) {
(V_attachState(vp) == VOL_STATE_SHUTTING_DOWN)) {
*ec = VNOVOL;
vp = NULL;
break;
}
/*
* short circuit with VOFFLINE for VOL_STATE_UNATTACHED and
* short circuit with VOFFLINE for VOL_STATE_UNATTACHED/GOING_OFFLINE and
* VNOVOL for VOL_STATE_DELETED
*/
if ((V_attachState(vp) == VOL_STATE_UNATTACHED) ||
(V_attachState(vp) == VOL_STATE_GOING_OFFLINE) ||
(V_attachState(vp) == VOL_STATE_DELETED)) {
if (vp->specialStatus) {
*ec = vp->specialStatus;