xfs_restore: Return error if error occurs restoring extent
PATCH 1/1 xfs_restore: Return error if error occurs restoring extent
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.
--- restore/content.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
restore/content.c +3 -2
@@ -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 */
Signature · 1 line
2.20.1
Quoted 33 lines · Frank 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_extentreturn an error code indicating the restore was incomplete.Signed-off-by Frank Sorenson <[email protected]>--- restore/content.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)restore/content.c +1
-1@@ -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 :
restore/content.c restore_extent(filehdr_t *fhdrp, · line 8668
Quoted 4 lines
restore/content.c +1
-0@@ -8665,12 +8665,13 @@ restore_extent(filehdr_t *fhdrp, fd =-1 ;assert (ntowrite <= (size_t )INTGENMAX ); nwritten = (int )ntowrite; + rv =RV_INCOMPLETE ;
I think this is reasonable but it's very hard to understand what this function does when so much of the loop body is all jammed against the right margin.
Reviewed-by:
Darrick J. Wong <[email protected]>
--D
Quoted 13 lines
restore/content.c +1
-1} 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 */ Signature · 1 line
2.20.1