From c637c4c6155c4b7c98669cfd3eed514f89c2e9fe Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 26 Mar 2013 17:26:23 -0500 Subject: [PATCH] volser: Restore Vol*ListOneVolume error handling In the 1.4 series, the volserver VolListOneVolume function always returned success if the specified volume was found in any way, and ENODEV otherwise. The VolXListOneVolume returned ENODEV if the volume was not found, or if any error occurred. DAFS (specifically, commit ed25934c1fe96b143715025b49104e75dce9a361) changed these so they both behave the same way. That is, they both return success if the volume was found at all, and ENODEV otherwise. Commit 53cc2ebaea5e5488d5285f0d13ffa47069ee986f changed both of these functions so that we always return an error on any attachment error. These changes mean that a 'vos examine' for a volume with an existing volume transaction now indicates that a volume is offline/unattached, but in the 1.4 series, the volume was indicated as "busy". So, restore the original 1.4 behavior of these functions, so the volume status is reported as it always was. This effectively reverts 53cc2ebaea5e5488d5285f0d13ffa47069ee986f, and slightly changes the post-DAFS code to look more like the 1.4 code. This also removes the 'code' variable from VolListOneVolume and adds an explicit comment about what's going on, to make this a little more clear. While changing the behavior of VolXListOneVolume to match that of VolListOneVolume perhaps makes sense, for now just restore the exact 1.4 behavior, and make the function flow look a little more like the 1.4 code did. A future change may make them the same again. Reported by Andy Malato. Reviewed-on: http://gerrit.openafs.org/9679 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 71afa42cdd9107b071fb79f0adaf96c5fcf145da) Change-Id: I2d7143bf4fde98a11104c5071317a2d2545f41c4 Reviewed-on: http://gerrit.openafs.org/9915 Reviewed-by: Andrew Deason Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- src/volser/volprocs.c | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 04a393e78..249dbdc56 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -2356,7 +2356,6 @@ VolListOneVolume(struct rx_call *acid, afs_int32 partid, DIR *dirp; afs_uint32 volid; int found = 0; - int code; volint_info_handle_t handle; volumeInfo->volEntries_val = (volintInfo *) malloc(sizeof(volintInfo)); @@ -2398,19 +2397,20 @@ VolListOneVolume(struct rx_call *acid, afs_int32 partid, handle.volinfo_type = VOLINT_INFO_TYPE_BASE; handle.volinfo_ptr.base = volumeInfo->volEntries_val; - code = GetVolInfo(partid, - volid, - pname, - volname, - &handle, - VOL_INFO_LIST_SINGLE); + /* The return code from GetVolInfo is ignored; there is no error from + * it that results in the whole call being aborted. Any volume + * attachment failures are reported in 'status' field in the + * volumeInfo payload. */ + GetVolInfo(partid, + volid, + pname, + volname, + &handle, + VOL_INFO_LIST_SINGLE); } closedir(dirp); - if (found) - return code ? ENODEV: 0; - else - return ENODEV; + return (found) ? 0 : ENODEV; } /*------------------------------------------------------------------------ @@ -2520,6 +2520,7 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, } if (found) { + int error; #ifndef AFS_PTHREAD_ENV IOMGR_Poll(); #endif @@ -2527,13 +2528,15 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, handle.volinfo_type = VOLINT_INFO_TYPE_EXT; handle.volinfo_ptr.ext = a_volumeXInfoP->volXEntries_val; - code = GetVolInfo(a_partID, - a_volID, - pname, - volname, - &handle, - VOL_INFO_LIST_SINGLE); - + error = GetVolInfo(a_partID, + a_volID, + pname, + volname, + &handle, + VOL_INFO_LIST_SINGLE); + if (!error) { + code = 0; + } } /* @@ -2541,10 +2544,7 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, * return the proper value. */ closedir(dirp); - if (found) - return code ? ENODEV: 0; - else - return ENODEV; + return code; } /*SAFSVolXListOneVolume */ /*returns all the volumes on partition partid. If flags = 1 then all the -- 2.39.5