linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Frank Sorenson <sorenson@redhat.com>
Cc: linux-xfs@vger.kernel.org, sandeen@sandeen.net
Subject: Re: [PATCH] xfs_restore: Return error if error occurs restoring extent
Date: Thu, 14 Nov 2019 10:26:47 -0800	[thread overview]
Message-ID: <20191114182647.GJ6219@magnolia> (raw)
In-Reply-To: <20191114074538.1220512-1-sorenson@redhat.com>

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@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;

							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@oracle.com>

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

      reply	other threads:[~2019-11-14 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191114182647.GJ6219@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=sorenson@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).