From d1711efd73b8dea177672eeb477a23d4a83b95b7 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 20 Oct 2011 16:57:14 -0500 Subject: [PATCH] viced: Do not swallow errors on StoreData recovery When we encounter any error in the StoreData fetch/store loop, we reset the disk usage to ensure it remains correct, even in the face of unexpected errors. However, when we do so, we use the errorCode from VAdjustDiskUsage as our return value; if it is 0, we return success, ignoring the error that got us in this code path in the first place. Instead, keep track of a temporary errorCode for the disk usage adjustment, and do not override our return value if there was no error in the disk usage numbers. Reviewed-on: http://gerrit.openafs.org/5645 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit dd831c09602f1ef16cc7dece84aeff638cce7272) Change-Id: I154e6cbc96ee4e32bee2da77441547c1dce8b42c Reviewed-on: http://gerrit.openafs.org/5711 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/viced/afsfileprocs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index a4ab129e0..95dd926d5 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -7482,6 +7482,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, FDH_SYNC(fdP); } if (errorCode) { + Error tmp_errorCode = 0; afs_sfsize_t nfSize = FDH_SIZE(fdP); osi_Assert(nfSize >= 0); /* something went wrong: adjust size and return */ @@ -7495,9 +7496,12 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, if (origfdP) FDH_REALLYCLOSE(origfdP); FDH_CLOSE(fdP); /* set disk usage to be correct */ - VAdjustDiskUsage(&errorCode, volptr, + VAdjustDiskUsage(&tmp_errorCode, volptr, (afs_sfsize_t) (nBlocks(nfSize) - nBlocks(NewLength)), 0); + if (tmp_errorCode) { + errorCode = tmp_errorCode; + } return errorCode; } if (origfdP) { /* finish CopyOnWrite */ -- 2.39.5