All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bill O'Donnell" <billodo@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH v3] xfs/424: test xfs_db to ensure type size taken into account with new type
Date: Mon, 17 Jul 2017 14:48:01 -0500	[thread overview]
Message-ID: <20170717194801.GA22123@redhat.com> (raw)
In-Reply-To: <e5a07a86-0081-7c7a-9807-a24c199c3abb@sandeen.net>

On Mon, Jul 17, 2017 at 02:41:04PM -0500, Eric Sandeen wrote:
> 
> 
> On 07/17/2017 01:53 PM, Bill O'Donnell wrote:
> > xfs_db should take type size into account when setting type.
> > If type size isn't updated whenever type is set, a false crc
> > error can occur due to the stale size. This test checks for
> > that false crc error.
> > 
> > Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > ---
> > v2: Clarify commit message and test comments. Add a few more test cases.
> > v3: Add more test cases. Use _scratch_xfs_db instead of $XFS_DB_PROG to
> >     accomodate fses with external logs. Remove superfluous daddr and type
> >     commands.
> > 
> >  tests/xfs/424     | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/424.out |  1 +
> >  tests/xfs/group   |  1 +
> >  3 files changed, 95 insertions(+)
> >  create mode 100755 tests/xfs/424
> >  create mode 100644 tests/xfs/424.out
> > 
> > diff --git a/tests/xfs/424 b/tests/xfs/424
> > new file mode 100755
> > index 00000000..8415ecd1
> > --- /dev/null
> > +++ b/tests/xfs/424
> > @@ -0,0 +1,93 @@
> > +#! /bin/bash
> > +# FS QA Test 424
> > +#
> > +# xfs_db should take type size into account when setting type.
> > +# If type size isn't updated whenever type is set, a false crc
> > +# error can occur due to the stale size. This test checks for
> > +# that false crc error.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017 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.*
> > +}
> > +
> > +_filter_dbval()
> > +{
> > +    awk '{ print $4 }'
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# Modify as appropriate
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_scratch
> > +
> > +# real QA test starts here
> > +_scratch_unmount >> $seqres.full 2>&1
> > +
> > +# for different sector sizes, ensure no CRC errors are falsely reported.
> > +
> > +# Supported types include: agf, agfl, agi, attr3, bmapbta,
> > +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata,
> > +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.
> > +# For various sector sizes, test some types that involve type size.
> > +for SECTOR_SIZE in 512 1024 2048 4096; do
> > +    $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null
> > +
> > +    for TYPE in agf agi agfl sb; do
> > +	DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval`
> > +	_scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE"
> > +    done
> > +
> > +    for TYPE in inodata data log text rtbitmap rtsummary; do
> > +	DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval`
> > +	_scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE"
> > +    done
> 
> Ok, I don't understand this part.  For each of those types, you get the address of
> the root inode, then set it to the type - including types which are... not inodes?

For this case, where addr set to rootino, the types included indeed work fine, but
"type inode" yields crc error(s). :/
It might make more sense to just leave the inodata data log text rtbitmap rtsummary
types out of the test. 

fs_db> sb
xfs_db> addr rootino
xfs_db> daddr
current daddr is 96
xfs_db> type inode
Metadata corruption detected at xfs_inode block 0x60/0x200
Metadata corruption detected at xfs_inode block 0x60/0x200
. . .


> 
> (sure, type text & type data can be anything, but the others are specific data
> types...)
> 
> > +
> > +    DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval`
> > +    _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt"
> > +    DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval`
> > +    _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt"
> > +    DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval`
> > +    _scratch_xfs_db -c "daddr $DADDR" -c "type inobt"
> > +    DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval`
> > +    _scratch_xfs_db -c "daddr $DADDR" -c "type finobt"
> 
> to test the generic data & text types, you could just do:
> 
> +    _scratch_xfs_db -c "daddr $DADDR" -c "type text"
> +    _scratch_xfs_db -c "daddr $DADDR" -c "type data"
> 
> here.  They don't hae CRCs anyway so if the test is truly to "test for crc errors"
> then maybe it's not needed, but it can't hurt to actually iterate through each type
> that's possible. 
> 
> > +done
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/424.out b/tests/xfs/424.out
> > new file mode 100644
> > index 00000000..d879a949
> > --- /dev/null
> > +++ b/tests/xfs/424.out
> > @@ -0,0 +1 @@
> > +QA output created by 424
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index ffdb0615..75c8280c 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -421,3 +421,4 @@
> >  421 auto quick clone dedupe
> >  422 dangerous_scrub dangerous_online_repair
> >  423 dangerous_scrub
> > +424 auto quick db
> > 

  reply	other threads:[~2017-07-17 19:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 18:31 [PATCH] xfs/424: test xfs_db to ensure sector size taken into account with new type Bill O'Donnell
2017-07-12 19:02 ` Eric Sandeen
2017-07-14 14:27 ` [PATCH] xfs/424: test xfs_db to ensure type " Bill O'Donnell
2017-07-14 15:42   ` Eric Sandeen
2017-07-14 16:47     ` Bill O'Donnell
2017-07-14 19:01       ` Eric Sandeen
2017-07-14 19:11         ` Bill O'Donnell
2017-07-14 19:58           ` Bill O'Donnell
2017-07-14 21:43             ` Eric Sandeen
2017-07-14 17:39     ` Darrick J. Wong
2017-07-17 18:53 ` [PATCH v3] " Bill O'Donnell
2017-07-17 19:41   ` Eric Sandeen
2017-07-17 19:48     ` Bill O'Donnell [this message]
2017-07-17 20:23       ` Eric Sandeen
2017-07-17 22:09 ` [PATCH v4] " Bill O'Donnell
2017-07-20  4:08   ` Eryu Guan
2017-07-21 14:53 ` [PATCH v5] " Bill O'Donnell
2017-07-24 11:54   ` Eryu Guan
2017-07-24 15:00     ` Bill O'Donnell
2017-07-24 15:07 ` [PATCH v6] " Bill O'Donnell

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=20170717194801.GA22123@redhat.com \
    --to=billodo@redhat.com \
    --cc=fstests@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 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.