]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
volser: Make VolListOneVolume errors consistent
authorAndrew Deason <adeason@sinenomine.net>
Tue, 26 Mar 2013 22:50:31 +0000 (17:50 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 12 Sep 2013 18:36:28 +0000 (11:36 -0700)
Currently, VolXListOneVolume errors out with ENODEV if any attachment
error occurs with the specified volume. But VolListOneVolume always
returns success if it can find the indicated volume, and any
attachment errors and such are reported in the 'status' field of the
volume info structure.

These two functions do pretty much the same thing; VolXListOneVolume
just provides more info than VolListOneVolume. So make them behave the
same way, and provide more specific information, whether or not
somebody ran 'vos examine' or 'vos examine -extended'.

The 'vos' binary has always handled errors in the 'status' volume info
structure for both "extended" and non-"extended" queries. This
difference appears to just have been a mistake from OpenAFS 1.0.

Reviewed-on: http://gerrit.openafs.org/9680
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 199cfb4a885b98b583f538ed14dff7ec5c9f9990)

Change-Id: I397c6b49eb7cfaef1c4dae16c1158dc0411701a3
Reviewed-on: http://gerrit.openafs.org/9916
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/volser/volprocs.c

index 249dbdc5686e104bb2a66e110af0f5119be368d7..90346b8822c71d670cf97e214c1c85482e42ffeb 100644 (file)
@@ -2457,7 +2457,6 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID,
     DIR *dirp;                 /*Partition directory ptr */
     afs_uint32 currVolID;              /*Current volume ID */
     int found = 0;             /*Did we find the volume we need? */
-    int code;
     volint_info_handle_t handle;
 
     /*
@@ -2471,7 +2470,6 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID,
     memset(a_volumeXInfoP->volXEntries_val, 0, sizeof(volintXInfo)); /* Clear structure */
 
     a_volumeXInfoP->volXEntries_len = 1;
-    code = ENODEV;
 
     /*
      * If the partition name we've been given is bad, bogue out.
@@ -2520,7 +2518,6 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID,
     }
 
     if (found) {
-       int error;
 #ifndef AFS_PTHREAD_ENV
        IOMGR_Poll();
 #endif
@@ -2528,15 +2525,16 @@ 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;
 
-       error = GetVolInfo(a_partID,
-                          a_volID,
-                          pname,
-                          volname,
-                          &handle,
-                          VOL_INFO_LIST_SINGLE);
-       if (!error) {
-           code = 0;
-       }
+       /* 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(a_partID,
+                  a_volID,
+                  pname,
+                  volname,
+                  &handle,
+                  VOL_INFO_LIST_SINGLE);
     }
 
     /*
@@ -2544,7 +2542,7 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID,
      * return the proper value.
      */
     closedir(dirp);
-    return code;
+    return (found) ? 0 : ENODEV;
 }                              /*SAFSVolXListOneVolume */
 
 /*returns all the volumes on partition partid. If flags = 1 then all the