All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/2] repair: fix unnecessary secondary scan if only last sb is corrupt
Date: Fri, 16 Jan 2015 07:05:59 -0500	[thread overview]
Message-ID: <20150116120559.GA3444@laptop.bfoster> (raw)
In-Reply-To: <54B834CB.2030400@sandeen.net>

On Thu, Jan 15, 2015 at 03:44:43PM -0600, Eric Sandeen wrote:
> On 1/13/15 2:08 PM, Brian Foster wrote:
> > verify_set_primary_sb() scans the secondary superbocks based on the
> > geometry specified in the primary and determines the most likely correct
> > geometry by tracking how many superblocks are consistent across the set.
> > The most frequent geometry is copied into the primary superblock. The
> > return value is checked by the caller (phase1()) to determine whether a
> > brute force secondary scan is necessary.
> > 
> > This generally occurs when not enough secondary sb's are consistent to
> > declare the geometry correct. If enough secondaries are consistent,
> > verify_set_primary_sb() returns the status of the last secondary sb that
> > was scanned. Corruptions to secondary supers other than the last are
> > thus resolved fine. If the last secondary is corrupt, however, an error
> > is returned to phase1(). This causes a brute force scan even if enough
> > supers were found to repair the last secondary.
> > 
> > Move the initialization of retval to after the sb scan to return an
> > error only if not enough secondary supers were found to declare a
> > correct geometry.
> > 
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
> 
> Nice.  Brute-force scan is awful, doing it when unnecessary stinks!  :)
> 
> could this be fstest-ed?
> 

Yeah, the problem is easy to reproduce with xfs_db (just corrupt the
last sb). I think a test that runs repair through a few sets of sb
corruptions should be easy enough. I'll look into it.

Another situation I ran into while playing with these is the brute force
scan finding an older secondary (i.e., from a previous mkfs) and
eventually falling over based on its geometry rather than continuing to
scan for the a secondary of the current fs. I wasn't sure what was going
on at the time so I zeroed off the bdev and retested to confirm that was
the problem. I wonder how likely something like that might be in the
real world...

> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> 

Thanks for reviewing these!

Brian

> > ---
> >  repair/sb.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/repair/sb.c b/repair/sb.c
> > index ad27756..dc154f7 100644
> > --- a/repair/sb.c
> > +++ b/repair/sb.c
> > @@ -724,7 +724,6 @@ verify_set_primary_sb(xfs_sb_t		*rsb,
> >  	 * sector size rather than the sector size in @rsb.
> >  	 */
> >  	size = NUM_AGH_SECTS * (1 << (XFS_MAX_SECTORSIZE_LOG));
> > -	retval = 0;
> >  	list = NULL;
> >  	num_ok = 0;
> >  	*sb_modified = 0;
> > @@ -779,6 +778,7 @@ verify_set_primary_sb(xfs_sb_t		*rsb,
> >  	/*
> >  	 * see if we have enough superblocks to bother with
> >  	 */
> > +	retval = 0;
> >  	if (num_ok < num_sbs / 2) {
> >  		retval = XR_INSUFF_SEC_SB;
> >  		goto out_free_list;
> > @@ -868,5 +868,5 @@ out_free_list:
> >  	free_geo(list);
> >  	free(sb);
> >  	free(checked);
> > -	return(retval);
> > +	return retval;
> >  }
> > 
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-01-16 12:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 20:08 [PATCH 0/2] xfsprogs/repair: secondary sb scan cleanups Brian Foster
2015-01-13 20:08 ` [PATCH 1/2] repair: fix unnecessary secondary scan if only last sb is corrupt Brian Foster
2015-01-15 21:44   ` Eric Sandeen
2015-01-16 12:05     ` Brian Foster [this message]
2015-01-13 20:08 ` [PATCH 2/2] repair: remove unused strided secondary sb scan logic Brian Foster
2015-01-15 23:15   ` Eric Sandeen

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=20150116120559.GA3444@laptop.bfoster \
    --to=bfoster@redhat.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.