volser: remove check for VL_ENTDELETED

Since the original IBM code import, UV_RestoreVolume2 (originally
UV_RestoreVolume) has checked for VL_ENTDELETED from VLDB_GetEntryByID.
However, if VL_ENTDELETED is received, we will act like we retrieved the
vlentry successfully. If the -verbose flag is given, we'll try to print
the entry (even though one was not returned), and we'll call VL_SetLock
for the volume, which will almost certainly also fail with VL_ENTDELETED
and bail out.

Furthermore (also since the original IBM import), there is no longer any
code path to set the volume entry flag VLDELETED. So it should be rare
for any VL_* RPC to return VL_ENTDELETED; that would require an entry to
have the VLDELETED flag carried over from a very old database.

Therefore, it is safe and reasonable to simply remove the check for
VL_ENTDELETED from UV_RestoreVolume2.  If we do somehow receive the
VL_ENTDELETED error code, vos will terminate with an error instead of
possibly printing an uninitialized entry.

In addition, remove the same check for VL_ENTDELETED in the equivalent
code path in libadmin's UV_RestoreVolume.

Change-Id: I11d1c3306f67d68de54780f6aac75e4c27779db4
Reviewed-on: https://gerrit.openafs.org/14357
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Mark Vitale 2020-09-09 17:22:44 -04:00 committed by Andrew Deason
parent f3b5bb9a05
commit 1073e94779
2 changed files with 2 additions and 2 deletions

View File

@ -2306,7 +2306,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
* VLDB to reflect the change.
*/
aVLDB_GetEntryByID(cellHandle, pvolid, RWVOL, &entry, &tst);
if (tst && tst != VL_NOENT && tst != VL_ENTDELETED) {
if (tst != 0 && tst != VL_NOENT) {
goto fail_UV_RestoreVolume;
}
if (tst == VL_NOENT) { /* it doesnot exist already */

View File

@ -4676,7 +4676,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
* VLDB to reflect the change.
*/
vcode = VLDB_GetEntryByID(pvolid, voltype, &entry);
if (vcode && vcode != VL_NOENT && vcode != VL_ENTDELETED) {
if (vcode != 0 && vcode != VL_NOENT) {
fprintf(STDERR,
"Could not fetch the entry for volume number %lu from VLDB \n",
(unsigned long)pvolid);