From 0a063815cc27ed065bcc9e4a91fb3a7b280818bb Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 3 Apr 2013 16:39:07 -0500 Subject: [PATCH] vos: Restore some VNOVOL error messages Many places in vos/vsprocs have code to delete a volume. Commit f4e73067cdef990262c69c38ac98761620a63f25 tried to refactor them by consolidating the common "delete" code into DoVolDelete. However, not all of the removed code had exactly the same behavior, and some of these variants were not handled by DoVolDelete. One such variation is that DoVolDelete always printed an error message if the target volume did not exist. But for some call sites this condition is not an error, and prior to the refactoring they did not print such an error message. Commit 1092cbe34fc8519826b3fa0565505b7bd81bc922 tried to correct this by suppressing the error message if the target volume does not exist. However, this means that all DoVolDelete calls do not print such an error, where some should and some should not print an error. This means that in some edge cases when we encounter an unexpected VNOVOL error, we now skip printing the specific error we got and instead go right to cleanup/recovery/exit. For a few other cases, we used to print an error and continue (because it is a non-fatal error or a warning), but now we print nothing when we encounter a VNOVOL error. Fix this by specifically printing an error for the VNOVOL error for DoVolDelete call sites that used to print such an error. Do this for all such sites except ones where we obviously print an error immediately afterwards anyway. This is just a quick targeted fix. A future more robust fix should involve altering DoVolDelete to handle all of the different behaviors expected by its various callers. Change-Id: Ia79bce3d2fed4acd62d517064db5b6be77f6e987 Reviewed-on: http://gerrit.openafs.org/9704 Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/volser/vsprocs.c | 53 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index aa25d43..f8ca003 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -1866,6 +1866,9 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, code = DoVolDelete(fromconn, newVol, afrompart, "cloned", 0, NULL, NULL); if (code) { + if (code == VNOVOL) { + EPRINT1(code, "Failed to start transaction on %u\n", newVol); + } error = code; goto mfail; } @@ -2028,9 +2031,13 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, fflush(STDOUT); } - if (volid && toconn) - DoVolDelete(toconn, volid, atopart, - "destination", 0, NULL, "Recovery:"); + if (volid && toconn) { + code = DoVolDelete(toconn, volid, atopart, + "destination", 0, NULL, "Recovery:"); + if (code == VNOVOL) { + EPRINT1(code, "Recovery: Failed to start transaction on %u\n", volid); + } + } /* put source volume on-line */ if (fromconn) { @@ -2069,19 +2076,29 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, /* delete backup volume */ if (fromconn) { - DoVolDelete(fromconn, backupId, afrompart, - "backup", 0, NULL, "Recovery:"); + code = DoVolDelete(fromconn, backupId, afrompart, + "backup", 0, NULL, "Recovery:"); + if (code == VNOVOL) { + EPRINT1(code, "Recovery: Failed to start transaction on %u\n", backupId); + } - DoVolDelete(fromconn, afromvol, afrompart, "source", - (atoserver != afromserver)?atoserver:0, + code = DoVolDelete(fromconn, afromvol, afrompart, "source", + (atoserver != afromserver)?atoserver:0, NULL, NULL); + if (code == VNOVOL) { + EPRINT1(code, "Failed to start transaction on %u\n", afromvol); + } } } /* common cleanup - delete local clone */ - if (newVol) - DoVolDelete(fromconn, newVol, afrompart, - "clone", 0, NULL, "Recovery:"); + if (newVol) { + code = DoVolDelete(fromconn, newVol, afrompart, + "clone", 0, NULL, "Recovery:"); + if (code == VNOVOL) { + EPRINT1(code, "Recovery: Failed to start transaction on %u\n", newVol); + } + } /* unlock VLDB entry */ if (islocked) { @@ -2458,6 +2475,9 @@ cpincr: code = DoVolDelete(fromconn, cloneVol, afrompart, "cloned", 0, NULL, NULL); if (code) { + if (code == VNOVOL) { + EPRINT1(code, "Failed to start transaction on %u\n", cloneVol); + } error = code; goto mfail; } @@ -2583,9 +2603,13 @@ cpincr: MapHostToNetwork(&entry); /* common cleanup - delete local clone */ - if (cloneVol) - DoVolDelete(fromconn, cloneVol, afrompart, - "clone", 0, NULL, "Recovery:"); + if (cloneVol) { + code = DoVolDelete(fromconn, cloneVol, afrompart, + "clone", 0, NULL, "Recovery:"); + if (code == VNOVOL) { + EPRINT1(code, "Recovery: Failed to start transaction on %u\n", cloneVol); + } + } done: /* routine cleanup */ if (fromconn) @@ -7283,6 +7307,9 @@ UV_VolumeZap(afs_uint32 server, afs_int32 part, afs_uint32 volid) aconn = UV_Bind(server, AFSCONF_VOLUMEPORT); error = DoVolDelete(aconn, volid, part, "the", 0, NULL, NULL); + if (error == VNOVOL) { + EPRINT1(error, "Failed to start transaction on %u\n", volid); + } PrintError("", error); if (aconn) -- 1.9.4