volser: improve error checking for 'vos restore' 47/14347/4
authorMark Vitale <mvitale@sinenomine.net>
Fri, 28 Aug 2020 19:42:06 +0000 (15:42 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 13 Nov 2020 15:21:56 +0000 (10:21 -0500)
UV_RestoreVolume2 calls VLDB_GetEntryByName to obtain information for
sanity checking, but only checks for a VL_NOENT error code; other codes
are thus ignored, which may lead to confusing results.

Add an additional error check for 'vos restore' (and other callers of
UV_RestoreVolume2) to stop and issue an error message if a non-VL_NOENT
error code is received from VLDB_GetEntryByName.

Change-Id: Idf41965fdd84fa282a3397215ec393ae10f72018
Reviewed-on: https://gerrit.openafs.org/14347
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/volser/vsprocs.c

index 66db46a..de0b900 100644 (file)
@@ -4536,6 +4536,11 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                goto refail;
            }
            reuseID = 0;
+       } else if (vcode) {
+           fprintf(STDERR, "Could not fetch the VLDB entry for the volume %s\n",
+                   tovolname);
+           error = vcode;
+           goto refail;
        } else if (flags & RV_RDONLY) {
            if (entry.flags & VLF_RWEXISTS) {
                fprintf(STDERR,