From: Derrick Brashear Date: Thu, 22 Jul 2010 04:39:31 +0000 (-0400) Subject: vol AttachByName should mimic other volpkg errors X-Git-Tag: debian/1.4.12.1+dfsg-3~5 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ca593bb83aaffd96e1965f6f3684c3136266b34f;p=packages%2Fo%2Fopenafs.git vol AttachByName should mimic other volpkg errors if later callers will deem a volume offline, note it at attach time. additionally, log the cause. (cherry picked from commit 939382c5c1622750665a9f543168bd3b8044583f) Change-Id: Ie5d4a6339749c4f1920a78722966b013e78ffd98 Reviewed-on: http://gerrit.openafs.org/2465 Reviewed-by: Jeffrey Altman Tested-by: Jason Edgecombe Tested-by: BuildBot Reviewed-by: Jason Edgecombe Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit fd19dd095a52be4a685ac80e8533b7a4388e145c) --- diff --git a/src/vol/volume.c b/src/vol/volume.c index 503dda231..8af3c66d9 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -979,6 +979,20 @@ attach2(Error * ec, char *path, register struct VolumeHeader * header, V_inUse(vp) = 1; V_offlineMessage(vp)[0] = '\0'; } + if (!V_inUse(vp)) { + *ec = VNOVOL; + /* mimic e.g. GetVolume errors */ + if (!V_blessed(vp)) + Log("Volume %u offline: not blessed\n", V_id(vp)); + else if (!V_inService(vp)) + Log("Volume %u offline: not in service\n", V_id(vp)); + else { + Log("Volume %u offline: needs salvage\n", V_id(vp)); + *ec = VOFFLINE; + } + VPutVolume_r(vp); + vp = NULL; + } } return vp;