public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 6/7] xfs_repair: check that metadata updates have been committed
Date: Tue, 25 Feb 2020 07:14:27 -0800	[thread overview]
Message-ID: <20200225151426.GC6748@magnolia> (raw)
In-Reply-To: <20200225150817.GC26938@bfoster>

On Tue, Feb 25, 2020 at 10:08:17AM -0500, Brian Foster wrote:
> On Mon, Feb 24, 2020 at 04:11:05PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Make sure that any metadata that we repaired or regenerated has been
> > written to disk.  If that fails, exit with 1 to signal that there are
> > still errors in the filesystem.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  repair/xfs_repair.c |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > 
> > diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> > index eb1ce546..ccb13f4a 100644
> > --- a/repair/xfs_repair.c
> > +++ b/repair/xfs_repair.c
> > @@ -703,6 +703,7 @@ main(int argc, char **argv)
> >  	struct xfs_sb	psb;
> >  	int		rval;
> >  	struct xfs_ino_geometry	*igeo;
> > +	int		error;
> >  
> >  	progname = basename(argv[0]);
> >  	setlocale(LC_ALL, "");
> > @@ -1104,7 +1105,11 @@ _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\
> >  	 */
> >  	libxfs_bcache_flush();
> >  	format_log_max_lsn(mp);
> > -	libxfs_umount(mp);
> > +
> > +	/* Report failure if anything failed to get written to our fs. */
> > +	error = -libxfs_umount(mp);
> > +	if (error)
> > +		exit(1);
> 
> I wonder a bit whether repair should really exit like this vs. report
> the error as it does for most others, but I could go either way. I'll
> defer to Eric:

I suppose I could do:

	error = -libxfs_umount();
	if (error)
		do_error(_("fs unmount failed (err=%d), re-run repair!\n"),
				error);

Though then you'd end up with:

	# xfs_repair /dev/fd0
	...
	Refusing to write corrupted metadata to the data device!
	fs unmount failed (err=117), re-run repair!
	# echo $?
	1

Which seems a little redundant.  But let's see what Eric thinks.

> Reviewed-by: Brian Foster <bfoster@redhat.com>

Anyway, thanks for reviewing!

--D

> >  
> >  	if (x.rtdev)
> >  		libxfs_device_close(x.rtdev);
> > 
> 

  reply	other threads:[~2020-02-25 15:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  0:10 [PATCH v3 0/7] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-25  0:10 ` [PATCH 1/7] libxfs: libxfs_buf_delwri_submit should write buffers immediately Darrick J. Wong
2020-02-25  0:10 ` [PATCH 2/7] libxfs: complain when write IOs fail Darrick J. Wong
2020-02-25  0:10 ` [PATCH 3/7] libxfs: return flush failures Darrick J. Wong
2020-02-25  0:10 ` [PATCH 4/7] libxfs: flush all dirty buffers and report errors when unmounting filesystem Darrick J. Wong
2020-02-25 15:07   ` Brian Foster
2020-02-25 17:37   ` Christoph Hellwig
2020-02-25  0:10 ` [PATCH 5/7] mkfs: check that metadata updates have been committed Darrick J. Wong
2020-02-25 15:08   ` Brian Foster
2020-02-25 17:37   ` Christoph Hellwig
2020-02-25  0:11 ` [PATCH 6/7] xfs_repair: " Darrick J. Wong
2020-02-25 15:08   ` Brian Foster
2020-02-25 15:14     ` Darrick J. Wong [this message]
2020-02-25 17:38       ` Christoph Hellwig
2020-02-29 22:37         ` Eric Sandeen
2020-02-25 19:24   ` [PATCH v2 " Darrick J. Wong
2020-02-25  0:11 ` [PATCH 7/7] libfrog: always fsync when flushing a device Darrick J. Wong
2020-02-25 17:38   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2020-02-28 23:35 [PATCH v4 0/7] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-28 23:36 ` [PATCH 6/7] xfs_repair: check that metadata updates have been committed Darrick J. Wong
2020-03-05 16:48   ` Christoph Hellwig

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=20200225151426.GC6748@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --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