vol AttachByName should mimic other volpkg errors

if later callers will deem a volume offline, note it at attach time.
additionally, log the cause.

Change-Id: I4870e8f3bfd8d7e69e448d3a445be81435407f0f
Reviewed-on: http://gerrit.openafs.org/2448
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Derrick Brashear 2010-07-19 14:17:21 -04:00
parent eb6914dbb3
commit 939382c5c1

View File

@ -3326,6 +3326,27 @@ attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp,
V_inUse(vp) = fileServer;
V_offlineMessage(vp)[0] = '\0';
}
if (!V_inUse(vp)) {
*ec = VNOVOL;
/* mimic e.g. GetVolume errors */
if (!V_blessed(vp))
Log("Volume %lu offline: not blessed\n", afs_printable_uint32_lu(V_id(vp)));
else if (!V_inService(vp))
Log("Volume %lu offline: not in service\n", afs_printable_uint32_lu(V_id(vp)));
else {
Log("Volume %lu offline: needs salvage\n", afs_printable_uint32_lu(V_id(vp)));
*ec = VOFFLINE;
#ifdef AFS_DEMAND_ATTACH_FS
/* see if we can recover */
VRequestSalvage_r(ec, vp, SALVSYNC_NEEDED, VOL_SALVAGE_INVALIDATE_HEADER);
vp->nUsers = 0;
goto error;
#endif
}
VPutVolume_r(vp);
vp = NULL;
}
} else {
#ifdef AFS_DEMAND_ATTACH_FS
if ((mode != V_PEEK) && (mode != V_SECRETLY))