From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: yu kuai <yukuai3@huawei.com>
Cc: guaneryu@gmail.com, jbacik@fusionio.com, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org, zhengbin13@huawei.com,
yi.zhang@huawei.com
Subject: Re: [PATCH] xfs/126: fix that corrupt xattr might fail with a small probability
Date: Wed, 8 Jan 2020 08:22:27 -0800 [thread overview]
Message-ID: <20200108162227.GD5552@magnolia> (raw)
In-Reply-To: <20200108092758.41363-1-yukuai3@huawei.com>
On Wed, Jan 08, 2020 at 05:27:58PM +0800, yu kuai wrote:
> The cmd used in xfs_db to corrupt xattr is "blocktrash -x 32
> -y $((blksz * 8)) -n8 -3", which means select random 8 bit from 32 to
> end of the block, and the changed bits are randomized. However,
> there is a small chance that corrupting xattr failed because irrelevant
> bits are chossen or the chooosen bits are not changed, which lead to
> output missmatch:
> QA output created by 126 QA output created by 126
> + create scratch fs + create scratch fs
> + mount fs image + mount fs image
> + make some files + make some files
> + check fs + check fs
> + check xattr + check xattr
> + corrupt xattr + corrupt xattr
> + mount image && modify xattr + mount image && modify xattr
> + repair fs + repair fs
> + mount image (2) + mount image (2)
> + chattr -R -i + chattr -R -i
> + modify xattr (2) + modify xattr (2)
> > # file: tmp/scratch/attrfile
> > user.x00000000="0000000000000000"
> >
> + check fs (2) + check fs (2)
>
> Fix the problem by adding a seed for random processing to select same
> bits each time, and inverting the selected bits.
>
> Signed-off-by: yu kuai <yukuai3@huawei.com>
> ---
> tests/xfs/126 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/xfs/126 b/tests/xfs/126
> index 4f9f8cf9..9b57e58b 100755
> --- a/tests/xfs/126
> +++ b/tests/xfs/126
> @@ -37,7 +37,7 @@ test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
> _require_attrs
> _require_populate_commands
> _require_xfs_db_blocktrash_z_command
> -test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
> +test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -2"
TBH I've wondered if blocktrash -3 and fuzz-random should snapshot the
buffer before randomizing it and try again if the contents don't change?
I suspect most of our fuzz tests expect "randomize the ____" to return
with ____ full of random junk, not the exact same contents as before.
--D
> rm -f $seqres.full
>
> @@ -72,7 +72,7 @@ echo "+ corrupt xattr"
> loff=1
> while true; do
> _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" | grep -q 'file attr block is unmapped' && break
> - _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
> + _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -s 1024 -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
> loff="$((loff + 1))"
> done
>
> --
> 2.17.2
>
next prev parent reply other threads:[~2020-01-08 16:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 9:27 [PATCH] xfs/126: fix that corrupt xattr might fail with a small probability yu kuai
2020-01-08 16:22 ` Darrick J. Wong [this message]
2020-01-09 3:56 ` yukuai (C)
2020-01-09 4:00 ` yukuai (C)
2020-01-09 16:46 ` Darrick J. Wong
2020-01-16 12:22 ` yukuai (C)
2020-01-16 16:03 ` Darrick J. Wong
2020-01-17 2:20 ` yukuai (C)
2020-01-17 3:10 ` yukuai (C)
2020-01-17 6:15 ` 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=20200108162227.GD5552@magnolia \
--to=darrick.wong@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=guaneryu@gmail.com \
--cc=jbacik@fusionio.com \
--cc=linux-xfs@vger.kernel.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
--cc=zhengbin13@huawei.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;
as well as URLs for NNTP newsgroup(s).