From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH v2] xfs_copy: flush target devices before exiting
Date: Wed, 10 Jun 2020 09:02:23 -0700 [thread overview]
Message-ID: <20200610160223.GF11245@magnolia> (raw)
In-Reply-To: <1397005d-04a7-0a06-0549-7633da125ba0@sandeen.net>
On Tue, Jun 09, 2020 at 11:31:52PM -0500, Eric Sandeen wrote:
>
> On 6/8/20 1:47 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Flush the devices we're copying to before exiting, so that we can report
> > any write errors.
>
> Hm, I hadn't really looked at xfs_copy in depth, funky stuff.
>
> So normally errors look something like:
>
> THE FOLLOWING COPIES FAILED TO COMPLETE
> $TARGET -- write error at offset ABC
> $TARGET -- seek error at offset XYZ
>
> if for some reason we didn't detect any errors until this final
> device flush, we'll only see:
>
> $TARGET -- flush error -Q
>
> and no header...
>
> Seems like this error needs to be integrated w/ the other error reporting,
> something like:
>
> check_errors(void)
> {
> int i, flush_error, first_error = 0;
>
> for (i = 0; i < num_targets; i++) {
> flush_error = platform_flush_device(target[i].fd, 0);
<shrug> I was gonna skip the flush error if the target already died,
but yeah I agree this should come before THE FOLLOWING COPIES WERE EATEN
BY CIRCUMSTANCE.
--D
>
> if (flush_error || target[i].state == INACTIVE) {
> if (first_error == 0) {
> first_error++;
> do_log(
> _("THE FOLLOWING COPIES FAILED TO COMPLETE\n"));
> }
> if (target[i].state == INACTIVE) {
> do_log(" %s -- ", target[i].name);
> if (target[i].err_type == 0)
> do_log(_("write error"));
> else
> do_log(_("lseek error"));
> do_log(_(" at offset %lld\n"), target[i].position);
> }
> if (flush_error)
> do_log(_(" %s -- flush error %d"),
> target[i].name, errno);
> }
> }
> if (first_error == 0) {
> fprintf(stdout, _("All copies completed.\n"));
> fflush(NULL);
> } else {
> fprintf(stderr, _("See \"%s\" for more details.\n"),
> logfile_name);
> exit(1);
> }
> }
>
>
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > copy/xfs_copy.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> > index 2d087f71..7657ad3e 100644
> > --- a/copy/xfs_copy.c
> > +++ b/copy/xfs_copy.c
> > @@ -12,6 +12,7 @@
> > #include <stdarg.h>
> > #include "xfs_copy.h"
> > #include "libxlog.h"
> > +#include "libfrog/platform.h"
> >
> > #define rounddown(x, y) (((x)/(y))*(y))
> > #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
> > @@ -150,6 +151,10 @@ check_errors(void)
> > else
> > do_log(_("lseek error"));
> > do_log(_(" at offset %lld\n"), target[i].position);
> > + } else if (platform_flush_device(target[i].fd, 0)) {
> > + do_log(_(" %s -- flush error %d"),
> > + target[i].name, errno);
> > + first_error++;
> > }
> > }
> > if (first_error == 0) {
> >
prev parent reply other threads:[~2020-06-10 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-08 18:47 [PATCH v2] xfs_copy: flush target devices before exiting Darrick J. Wong
2020-06-10 4:31 ` Eric Sandeen
2020-06-10 16:02 ` 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=20200610160223.GF11245@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
/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