public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 08/10] xfs_db: enable blocktrash for checksummed filesystems
Date: Wed, 19 Aug 2015 08:22:47 -0700	[thread overview]
Message-ID: <20150819152247.GR10043@birch.djwong.org> (raw)
In-Reply-To: <55D386ED.604@sandeen.net>

On Tue, Aug 18, 2015 at 02:26:37PM -0500, Eric Sandeen wrote:
> On 8/14/15 8:44 PM, Darrick J. Wong wrote:
> > Disable the write verifiers when we're trashing a block.  With this
> > in place, create a xfs fuzzer script that formats, populates, corrupts,
> > tries to use, repairs, and tries again to use a crash test xfs image.
> > Hopefully this will shake out some v5 filesystem bugs.
> 
> Maybe "we can create an xfs fuzzer script ..." (since it's not in this
> patch)

"With this in place, the new fuzzers group in xfstests can format, populate..."

> > v2: Drop xfsfuzz, don't assume every block is an AGF when blocktrashing.
> > Don't trash log blocks by default, because that skews the blocktrash
> > heavily towards damaging only log blocks.

"v3: Fix changelog issues, allow trashing of log blocks and symlinks,
and require the caller to explicitly ask for trashing of log blocks
and super blocks.  Allowing log blocks by default skews the trashing
heavily in favor of (probably unused) log blocks, which doesn't help
us with fuzzing.  Furthermore, trashing the superblock results in a
time consuming sector by sector superblock hunt."

> 
> and skip DBM_SB by default as well, right?
> 
> And you added log blocks & symlinks to the allowed mask.
> 
> So I think something like:
> 
> Allow trashing of symlink & log blocks.
> By default, do not trash superblocks (why?) or log blocks (because ...)
> 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  db/check.c |   10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/db/check.c b/db/check.c
> > index afeea32..965d0f5 100644
> > --- a/db/check.c
> > +++ b/db/check.c
> > @@ -944,6 +944,7 @@ blocktrash_b(
> >  	int		mask;
> >  	int		newbit;
> >  	int		offset;
> > +	const struct xfs_buf_ops *stashed_ops;
> >  	static char	*modestr[] = {
> >  		N_("zeroed"), N_("set"), N_("flipped"), N_("randomized")
> >  	};
> > @@ -952,8 +953,10 @@ blocktrash_b(
> >  	offset = (int)(random() % (int)(mp->m_sb.sb_blocksize * NBBY));
> >  	newbit = 0;
> >  	push_cur();
> > -	set_cur(&typtab[DBM_UNKNOWN],
> > +	set_cur(NULL,
> >  		XFS_AGB_TO_DADDR(mp, agno, agbno), blkbb, DB_RING_IGN, NULL);
> 
> Ok, you talked about this back on 5/28/15.  Weird.
> 
> But calling it with NULL is odd, too; nothing else does that.  What about TYP_NONE,
> 
>         { TYP_NONE, NULL }
> 
> its ops are NULL, as well... does that work?
> Huh, ok, no callers w/ TYP_NONE, either.  I guess NULL works.

I'm impressed you can remember that far back. :)

> > +	stashed_ops = iocur_top->bp->b_ops;
> > +	iocur_top->bp->b_ops = NULL;
> >  	if ((buf = iocur_top->data) == NULL) {
> >  		dbprintf(_("can't read block %u/%u for trashing\n"), agno, agbno);
> >  		pop_cur();
> > @@ -984,6 +987,7 @@ blocktrash_b(
> >  			buf[byte] &= ~mask;
> >  	}
> >  	write_cur();
> > +	iocur_top->bp->b_ops = stashed_ops;
> 
> *nod*
> 
> >  	pop_cur();
> >  	printf(_("blocktrash: %u/%u %s block %d bit%s starting %d:%d %s\n"),
> >  		agno, agbno, typename[type], len, len == 1 ? "" : "s",
> > @@ -1040,9 +1044,11 @@ blocktrash_f(
> >  		   (1 << DBM_BTINO) |
> >  		   (1 << DBM_DIR) |
> >  		   (1 << DBM_INODE) |
> > +		   (1 << DBM_LOG) |
> 
> Ok, so you allow log blocks to be specified,
> 
> >  		   (1 << DBM_QUOTA) |
> >  		   (1 << DBM_RTBITMAP) |
> >  		   (1 << DBM_RTSUM) |
> > +		   (1 << DBM_SYMLINK) |
> 
> and symlink blocks too, but...
> 
> >  		   (1 << DBM_SB);
> >  	while ((c = getopt(argc, argv, "0123n:s:t:x:y:")) != EOF) {
> >  		switch (c) {
> > @@ -1106,7 +1112,7 @@ blocktrash_f(
> >  		return 0;
> >  	}
> >  	if (tmask == 0)
> > -		tmask = goodmask;
> > +		tmask = goodmask & ~((1 << DBM_LOG) | (1 << DBM_SB));
> 
> you disable log & superblocks by default if no mask is specified.
> 
> I'm not 100% sure why you want to change this, what did you run into,
> in practice, if they were allowed?

I found that with log block trashing turned on, we'd most frequently
trash empty log blocks; if there wasn't anything in the log to get
replayed, the corruption wouldn't show up.  So, make the user
explicitly ask for log blocks to be included in the trash mask.

As for requiring the user to ask for superblocks to be in the trash
mask, that's mostly to prevent the behavior that if repair finds a
garbage superblock it'll scan every sector on the whole disk looking
for superblocks, which is pretty slow...

> If the change stays, then the xfs_db manpage needs an update:
> 
> "If no -t options are given then all metadata types can be trashed."

Ok.

--D

> 
> Thanks,
> -Eric
> 
> 
> >  	lentab = xmalloc(sizeof(ltab_t));
> >  	lentab->min = lentab->max = min;
> >  	lentablen = 1;
> > 
> > _______________________________________________
> > 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

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

  reply	other threads:[~2015-08-19 15:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-15  1:43 [PATCH 00/10] xfsprogs August 2015 patchbomb Darrick J. Wong
2015-08-15  1:43 ` [PATCH 01/10] libxfs: readahead of dir3 data blocks should use the read verifier Darrick J. Wong
2015-08-17 18:31   ` Eric Sandeen
2015-08-17 20:30     ` Darrick J. Wong
2015-08-15  1:43 ` [PATCH 02/10] xfs_db: don't crash on a corrupt inode Darrick J. Wong
2015-08-17 18:52   ` Eric Sandeen
2015-08-17 20:45     ` Darrick J. Wong
2015-08-15  1:43 ` [PATCH 03/10] xfs_repair: ignore "repaired" flag after we decide to clear xattr block Darrick J. Wong
2015-08-17 19:20   ` Eric Sandeen
2015-08-17 20:50     ` Darrick J. Wong
2015-08-15  1:44 ` [PATCH 04/10] xfs_repair: fix broken EFSBADCRC/EFSCORRUPTED usage with buffer errors Darrick J. Wong
2015-08-17 19:51   ` Eric Sandeen
2015-08-17 19:57     ` Eric Sandeen
2015-08-15  1:44 ` [PATCH 05/10] xfs_repair: force not-so-bad bmbt blocks back through the verifier Darrick J. Wong
2015-08-17 21:14   ` Eric Sandeen
2015-08-17 23:48     ` Darrick J. Wong
2015-08-15  1:44 ` [PATCH 06/10] xfs_repair: mark unreachable prefetched metadata blocks stale Darrick J. Wong
2015-08-15  1:44 ` [PATCH 07/10] xfs_io: support reflinking and deduping file ranges Darrick J. Wong
2015-08-15  1:44 ` [PATCH 08/10] xfs_db: enable blocktrash for checksummed filesystems Darrick J. Wong
2015-08-18 19:26   ` Eric Sandeen
2015-08-19 15:22     ` Darrick J. Wong [this message]
2015-08-15  1:44 ` [PATCH 09/10] xfs_db: trash the block at the top of the cursor stack Darrick J. Wong
2015-08-18 19:59   ` Eric Sandeen
2015-08-19 15:12     ` Darrick J. Wong
2015-08-15  1:44 ` [PATCH 10/10] xfs_db: enable blockget for v5 filesystems 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=20150819152247.GR10043@birch.djwong.org \
    --to=darrick.wong@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox