linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs_restore: Return error if error occurs restoring extent
@ 2019-11-14  7:45 Frank Sorenson
  2019-11-14 18:26 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Sorenson @ 2019-11-14  7:45 UTC (permalink / raw)
  To: linux-xfs; +Cc: sandeen, sorenson

If an error occurs during write while restoring an extent,
no error is currently propagated back to the caller, so
xfsrestore can return SUCCESS on a failed restore.

Make restore_extent return an error code indicating the
restore was incomplete.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
 restore/content.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/restore/content.c b/restore/content.c
index 6b22965..c267234 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -8446,6 +8446,7 @@ restore_extent(filehdr_t *fhdrp,
 	off64_t new_off;
 	struct dioattr da;
 	bool_t isrealtime = BOOL_FALSE;
+	rv_t rv = RV_OK;
 
 	*bytesreadp = 0;
 
@@ -8496,7 +8497,6 @@ restore_extent(filehdr_t *fhdrp,
 		req_bufsz = (size_t)min((off64_t)INTGENMAX, sz);
 		bufp = (*dop->do_read)(drivep, req_bufsz, &sup_bufsz, &rval);
 		if (rval) {
-			rv_t rv;
 			char *reasonstr;
 			switch(rval) {
 			case DRIVE_ERROR_EOF:
@@ -8665,12 +8665,13 @@ restore_extent(filehdr_t *fhdrp,
 			fd = -1;
 			assert(ntowrite <= (size_t)INTGENMAX);
 			nwritten = (int)ntowrite;
+			rv = RV_INCOMPLETE;
 		}
 		sz -= (off64_t)sup_bufsz;
 		off += (off64_t)nwritten;
 	}
 
-	return RV_OK;
+	return rv;
 }
 
 static char *extattrbufp = 0; /* ptr to start of all the extattr buffers */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14  7:45 [PATCH] xfs_restore: Return error if error occurs restoring extent Frank Sorenson
2019-11-14 18:26 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).