linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Brian Foster <bfoster@redhat.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 08/10] xfs_repair: allow setting the needsrepair flag
Date: Tue, 9 Feb 2021 10:10:01 -0800	[thread overview]
Message-ID: <20210209181001.GT7193@magnolia> (raw)
In-Reply-To: <20210209172121.GF14273@bfoster>

On Tue, Feb 09, 2021 at 12:21:21PM -0500, Brian Foster wrote:
> On Mon, Feb 08, 2021 at 08:10:49PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Quietly set up the ability to tell xfs_repair to set NEEDSREPAIR at
> > program start and (presumably) clear it by the end of the run.  This
> > code isn't terribly useful to users; it's mainly here so that fstests
> > can exercise the functionality.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  repair/globals.c    |    2 ++
> >  repair/globals.h    |    2 ++
> >  repair/phase1.c     |   23 +++++++++++++++++++++++
> >  repair/xfs_repair.c |    9 +++++++++
> >  4 files changed, 36 insertions(+)
> > 
> > 
> ...
> > diff --git a/repair/phase1.c b/repair/phase1.c
> > index 00b98584..b26d25f8 100644
> > --- a/repair/phase1.c
> > +++ b/repair/phase1.c
> > @@ -30,6 +30,26 @@ alloc_ag_buf(int size)
> >  	return(bp);
> >  }
> >  
> > +static void
> > +set_needsrepair(
> > +	struct xfs_sb	*sb)
> > +{
> > +	if (!xfs_sb_version_hascrc(sb)) {
> > +		printf(
> > +	_("needsrepair flag only supported on V5 filesystems.\n"));
> > +		exit(0);
> > +	}
> > +
> > +	if (xfs_sb_version_needsrepair(sb)) {
> > +		printf(_("Filesystem already marked as needing repair.\n"));
> > +		return;
> > +	}
> 
> Any reason this doesn't exit the repair like the lazy counter logic
> does? Otherwise seems fine:

No particular reason.  Will fix for consistency's sake.

> Reviewed-by: Brian Foster <bfoster@redhat.com>
> 
> > +
> > +	printf(_("Marking filesystem in need of repair.\n"));
> > +	primary_sb_modified = 1;
> > +	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> > +}
> > +
> >  /*
> >   * this has got to be big enough to hold 4 sectors
> >   */
> > @@ -126,6 +146,9 @@ _("Cannot disable lazy-counters on V5 fs\n"));
> >  		}
> >  	}
> >  
> > +	if (add_needsrepair)
> > +		set_needsrepair(sb);
> > +
> >  	/* shared_vn should be zero */
> >  	if (sb->sb_shared_vn) {
> >  		do_warn(_("resetting shared_vn to zero\n"));
> > diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> > index 9dc73854..ee377e8a 100644
> > --- a/repair/xfs_repair.c
> > +++ b/repair/xfs_repair.c
> > @@ -65,11 +65,13 @@ static char *o_opts[] = {
> >   */
> >  enum c_opt_nums {
> >  	CONVERT_LAZY_COUNT = 0,
> > +	CONVERT_NEEDSREPAIR,
> >  	C_MAX_OPTS,
> >  };
> >  
> >  static char *c_opts[] = {
> >  	[CONVERT_LAZY_COUNT]	= "lazycount",
> > +	[CONVERT_NEEDSREPAIR]	= "needsrepair",
> >  	[C_MAX_OPTS]		= NULL,
> >  };
> >  
> > @@ -302,6 +304,13 @@ process_args(int argc, char **argv)
> >  					lazy_count = (int)strtol(val, NULL, 0);
> >  					convert_lazy_count = 1;
> >  					break;
> > +				case CONVERT_NEEDSREPAIR:
> > +					if (!val)
> > +						do_abort(
> > +		_("-c needsrepair requires a parameter\n"));
> > +					if (strtol(val, NULL, 0) == 1)
> > +						add_needsrepair = true;
> > +					break;
> >  				default:
> >  					unknown('c', val);
> >  					break;
> > 
> 

  reply	other threads:[~2021-02-09 18:24 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  4:10 [PATCHSET v4 00/10] xfs: add the ability to flag a fs for repair Darrick J. Wong
2021-02-09  4:10 ` [PATCH 01/10] xfs_admin: clean up string quoting Darrick J. Wong
2021-02-09  9:07   ` Christoph Hellwig
2021-02-09  4:10 ` [PATCH 02/10] xfs_admin: support filesystems with realtime devices Darrick J. Wong
2021-02-09  9:08   ` Christoph Hellwig
2021-02-09 17:19   ` Brian Foster
2021-02-09  4:10 ` [PATCH 03/10] xfs_db: support the needsrepair feature flag in the version command Darrick J. Wong
2021-02-09  9:09   ` Christoph Hellwig
2021-02-09 17:15     ` Darrick J. Wong
2021-02-09 17:19   ` Brian Foster
2021-02-09  4:10 ` [PATCH 04/10] xfs_repair: fix unmount error message to have a newline Darrick J. Wong
2021-02-09  9:09   ` Christoph Hellwig
2021-02-09  4:10 ` [PATCH 05/10] xfs_repair: clear quota CHKD flags on the incore superblock too Darrick J. Wong
2021-02-09  9:10   ` Christoph Hellwig
2021-02-09 17:20   ` Brian Foster
2021-02-09 17:46     ` Darrick J. Wong
2021-02-09  4:10 ` [PATCH 06/10] xfs_repair: clear the needsrepair flag Darrick J. Wong
2021-02-09  9:12   ` Christoph Hellwig
2021-02-09 17:20   ` Brian Foster
2021-02-09 18:01     ` Darrick J. Wong
2021-02-09  4:10 ` [PATCH 07/10] xfs_repair: set NEEDSREPAIR when we deliberately corrupt directories Darrick J. Wong
2021-02-09  9:13   ` Christoph Hellwig
2021-02-09 18:45     ` Darrick J. Wong
2021-02-09 17:20   ` Brian Foster
2021-02-09 18:35     ` Darrick J. Wong
2021-02-09 19:14       ` Brian Foster
2021-02-09 19:43         ` Darrick J. Wong
2021-02-10 20:19           ` Eric Sandeen
2021-02-09  4:10 ` [PATCH 08/10] xfs_repair: allow setting the needsrepair flag Darrick J. Wong
2021-02-09  9:15   ` Christoph Hellwig
2021-02-09 14:41     ` Eric Sandeen
2021-02-09 16:47       ` Darrick J. Wong
2021-02-10 20:44         ` Eric Sandeen
2021-02-09 17:21   ` Brian Foster
2021-02-09 18:10     ` Darrick J. Wong [this message]
2021-02-10 20:26       ` Eric Sandeen
2021-02-09  4:10 ` [PATCH 09/10] xfs_repair: add a testing hook for NEEDSREPAIR Darrick J. Wong
2021-02-09  9:16   ` Christoph Hellwig
2021-02-09 17:21   ` Brian Foster
2021-02-09 18:17     ` Darrick J. Wong
2021-02-09 18:59       ` Brian Foster
2021-02-09 19:59         ` Darrick J. Wong
2021-02-09 20:32           ` Brian Foster
2021-02-10 21:41           ` Eric Sandeen
2021-02-11  1:30             ` Darrick J. Wong
2021-02-09  4:11 ` [PATCH 10/10] xfs_admin: support adding features to V5 filesystems Darrick J. Wong
2021-02-09  9:18   ` Christoph Hellwig
2021-02-09 17:22   ` Brian Foster
2021-02-09 18:22     ` Darrick J. Wong

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=20210209181001.GT7193@magnolia \
    --to=djwong@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).