All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] xfs: test inobt/on disk free state mismatches
Date: Tue, 8 May 2018 08:37:12 +1000	[thread overview]
Message-ID: <20180507223711.GI10363@dastard> (raw)
In-Reply-To: <20180507165418.GE4116@magnolia>

On Mon, May 07, 2018 at 09:54:18AM -0700, Darrick J. Wong wrote:
> On Mon, May 07, 2018 at 08:53:52AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Fuzzing has recently uncovered a couple of conditions where we don't
> > detect corruptions that reallocate already allocated inodes. This
> > test exercises those cases, and checks that we shut down the
> > filesystem appropriately when such a corruption occurs.
> > 
> > Signed-Off-By: Dave Chinner <dchinner@redhat.com>
> > ---
> >  tests/xfs/450     | 73 +++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/450.out | 26 +++++++++++++++++
> >  tests/xfs/group   |  1 +
> >  3 files changed, 100 insertions(+)
> >  create mode 100755 tests/xfs/450
> >  create mode 100644 tests/xfs/450.out
> > 
> > diff --git a/tests/xfs/450 b/tests/xfs/450
> > new file mode 100755
> > index 000000000000..bac001690d60
> > --- /dev/null
> > +++ b/tests/xfs/450
> > @@ -0,0 +1,73 @@
> > +#! /bin/bash
> > +# FS QA Test 450
> > +#
> > +# Catch inobt/on disk inode free state mismatches on V4 filesystems
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2018 Red Hat, Inc.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +
> > +_supported_fs xfs
> > +_supported_os Linux
> > +
> > +# we intentionally corrupt the filesystem, so don't check it after the test
> > +_require_scratch_nocheck
> > +
> > +# on success, we'll get a shutdown filesystem with a really noisy log message
> > +# due to transaction cancellation.  Hence we don't want to check dmesg here.
> > +_disable_dmesg_check
> > +
> > +_require_xfs_mkfs_crc
> > +_scratch_mkfs -m crc=0 > $seqres.full 2>&1
> 
> We require mkfs to support crc but then turn it off?  Seeing as this is
> a v4 test I'd have expected this also to run on old xfsprogs that only
> supports v4. <confused>

Yup, copied that from another test that does exactly the same thing.
We have to do that to build v4 filesystems on modern xfsprogs that
default to v5, but using -m crc without a check for that
functionality will break the test on older xfsprogs....

> > +
> > +# corrupt an inode in the root inode chunk
> > +root_ino=`$XFS_DB_PROG -c "sb 0" -c "p rootino" $SCRATCH_DEV`
> 
> root_ino=$(_scratch_xfs_get_metadata_field 'rootino' 'sb 0')

Oh, didn't know that existed.

> > +corrupt_ino=$((root_ino + 15))
> > +$XFS_DB_PROG -x -c "inode $corrupt_ino" -c "write core.mode 0100644" $SCRATCH_DEV
> 
> _scratch_xfs_set_metadata_field 'core.mode' 0100644 "inode $corrupt_ino"

ditto.  Will fix.

Cheers,

dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-05-07 22:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06 22:53 [PATCH] xfs: test inobt/on disk free state mismatches Dave Chinner
2018-05-07 16:54 ` Darrick J. Wong
2018-05-07 22:37   ` Dave Chinner [this message]
2018-05-07 23:05 ` [PATCH V2] " Dave Chinner
2018-05-08  0:55   ` Eryu Guan
2018-05-10 23:04     ` Dave Chinner
2018-05-11  3:04       ` Eryu Guan

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=20180507223711.GI10363@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    /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.