From: "Darrick J. Wong" <djwong@kernel.org>
To: Zorro Lang <zlang@redhat.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 1/1] generic: add a regression test for sub-block fsmap queries
Date: Thu, 19 Sep 2024 13:13:10 -0700 [thread overview]
Message-ID: <20240919201310.GL182218@frogsfrogsfrogs> (raw)
In-Reply-To: <20240919200703.xyn5tqv5knqzgiq3@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>
On Fri, Sep 20, 2024 at 04:07:03AM +0800, Zorro Lang wrote:
> On Wed, Sep 18, 2024 at 01:57:19PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Zizhi Wo found some bugs in the GETFSMAP implementation if it is fed
> > sub-fsblock ranges. Add a regression test for this.
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > tests/generic/1954 | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
> > tests/generic/1954.out | 15 +++++++++
> > 2 files changed, 94 insertions(+)
> > create mode 100755 tests/generic/1954
> > create mode 100644 tests/generic/1954.out
> >
> >
> > diff --git a/tests/generic/1954 b/tests/generic/1954
> > new file mode 100755
> > index 0000000000..cfdfaf15e2
> > --- /dev/null
> > +++ b/tests/generic/1954
> > @@ -0,0 +1,79 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2024 Oracle. All Rights Reserved.
> > +#
> > +# FS QA Test No. 1954
> > +#
> > +# Regression test for sub-fsblock key handling errors in GETFSMAP.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto rmap fsmap
> > +
> > +_fixed_by_kernel_commit XXXXXXXXXXXX \
> > + "xfs: Fix the owner setting issue for rmap query in xfs fsmap"
> > +_fixed_by_kernel_commit XXXXXXXXXXXX \
> > + "xfs: Fix missing interval for missing_owner in xfs fsmap"
>
> These 2 patches have been merged:
>
> 68415b349f3f xfs: Fix the owner setting issue for rmap query in xfs fsmap
> ca6448aed4f1 xfs: Fix missing interval for missing_owner in xfs fsmap
>
> I'll help to update the commit id when I merge it.
Oops, will go fix that.
> > +
> > +. ./common/filter
> > +
> > +_require_xfs_io_command "fsmap"
> > +_require_scratch
> > +
> > +_scratch_mkfs >> $seqres.full
> > +_scratch_mount
> > +
> > +blksz=$(_get_block_size "$SCRATCH_MNT")
> > +if ((blksz < 2048)); then
> > + _notrun "test requires at least 4 bblocks per fsblock"
>
> What if the device is hard 4k sector size?
Doesn't matter, because the bug is in converting GETFSMAP inputs that
are a multiple of 512 but not a multiple of $fsblocksize.
> > +fi
> > +
> > +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT >> $seqres.full
> > +
> > +find_freesp() {
> > + $XFS_IO_PROG -c 'fsmap -d' $SCRATCH_MNT | tr '.[]:' ' ' | \
> > + grep 'free space' | awk '{printf("%s:%s\n", $4, $5);}' | \
> > + head -n 1
> > +}
> > +
> > +filter_fsmap() {
> > + _filter_xfs_io_numbers | sed \
> > + -e 's/inode XXXX data XXXX..XXXX/inode data/g' \
> > + -e 's/inode XXXX attr XXXX..XXXX/inode attr/g' \
> > + -e 's/: free space XXXX/: FREE XXXX/g' \
> > + -e 's/: [a-z].*XXXX/: USED XXXX/g'
>
> As this's a generic test case, I tried it on btrfs and ext4. btrfs got
> _notrun "xfs_io fsmap support is missing", ext4 got failure as:
>
> # diff -u /root/git/xfstests/tests/generic/1954.out /root/git/xfstests/results//default/generic/1954.out.bad
> --- /root/git/xfstests/tests/generic/1954.out 2024-09-20 03:51:02.545504285 +0800
> +++ /root/git/xfstests/results//default/generic/1954.out.bad 2024-09-20 03:58:51.505271227 +0800
> @@ -1,15 +1,11 @@
> QA output created by 1954
> test incorrect setting of high key
> - XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> test missing free space extent
> XXXX: XXXX:XXXX [XXXX..XXXX]: FREE XXXX
> test whatever came before freesp
> - XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> test whatever came after freesp
> - XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> test crossing start of freesp
> XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> XXXX: XXXX:XXXX [XXXX..XXXX]: FREE XXXX
> test crossing end of freesp
> XXXX: XXXX:XXXX [XXXX..XXXX]: FREE XXXX
> - XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
Yep, we'll still have to patch ext4 for this. btrfs doesn't support
GETFSMAP.
--D
> Thanks,
> Zorro
>
> > +}
> > +
> > +$XFS_IO_PROG -c 'fsmap -d' $SCRATCH_MNT | filter_fsmap >> $seqres.full
> > +
> > +freesp="$(find_freesp)"
> > +
> > +freesp_start="$(echo "$freesp" | cut -d ':' -f 1)"
> > +freesp_end="$(echo "$freesp" | cut -d ':' -f 2)"
> > +echo "$freesp:$freesp_start:$freesp_end" >> $seqres.full
> > +
> > +echo "test incorrect setting of high key"
> > +$XFS_IO_PROG -c 'fsmap -d 0 3' $SCRATCH_MNT | filter_fsmap
> > +
> > +echo "test missing free space extent"
> > +$XFS_IO_PROG -c "fsmap -d $((freesp_start + 1)) $((freesp_start + 2))" $SCRATCH_MNT | \
> > + filter_fsmap
> > +
> > +echo "test whatever came before freesp"
> > +$XFS_IO_PROG -c "fsmap -d $((freesp_start - 3)) $((freesp_start - 2))" $SCRATCH_MNT | \
> > + filter_fsmap
> > +
> > +echo "test whatever came after freesp"
> > +$XFS_IO_PROG -c "fsmap -d $((freesp_end + 2)) $((freesp_end + 3))" $SCRATCH_MNT | \
> > + filter_fsmap
> > +
> > +echo "test crossing start of freesp"
> > +$XFS_IO_PROG -c "fsmap -d $((freesp_start - 2)) $((freesp_start + 1))" $SCRATCH_MNT | \
> > + filter_fsmap
> > +
> > +echo "test crossing end of freesp"
> > +$XFS_IO_PROG -c "fsmap -d $((freesp_end - 1)) $((freesp_end + 2))" $SCRATCH_MNT | \
> > + filter_fsmap
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/generic/1954.out b/tests/generic/1954.out
> > new file mode 100644
> > index 0000000000..6baec43511
> > --- /dev/null
> > +++ b/tests/generic/1954.out
> > @@ -0,0 +1,15 @@
> > +QA output created by 1954
> > +test incorrect setting of high key
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> > +test missing free space extent
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: FREE XXXX
> > +test whatever came before freesp
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> > +test whatever came after freesp
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> > +test crossing start of freesp
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: FREE XXXX
> > +test crossing end of freesp
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: FREE XXXX
> > + XXXX: XXXX:XXXX [XXXX..XXXX]: USED XXXX
> >
> >
>
next prev parent reply other threads:[~2024-09-19 20:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 20:57 [PATCHSET] fstests: updates for Linux 6.11 Darrick J. Wong
2024-09-18 20:57 ` [PATCH 1/1] generic: add a regression test for sub-block fsmap queries Darrick J. Wong
2024-09-19 20:07 ` Zorro Lang
2024-09-19 20:13 ` Darrick J. Wong [this message]
2024-09-20 14:33 ` Zorro Lang
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=20240919201310.GL182218@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.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.