Re: [PATCH] xfs_restore: Return error if error occurs restoring extent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 14, 2019 at 01:45:38AM -0600, Frank Sorenson wrote:
> 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@xxxxxxxxxx>
> ---
>  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;

							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
							<darrick.wong@xxxxxxxxxx>

							--D

>  		}
>  		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
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux