* [PATCH 01/16] generic/757: fix various bugs in this test
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
@ 2024-11-26 1:20 ` Darrick J. Wong
2024-11-28 7:56 ` Zorro Lang
2024-11-26 1:21 ` [PATCH 02/16] generic/757: convert to thinp Darrick J. Wong
` (15 subsequent siblings)
16 siblings, 1 reply; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:20 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Fix this test so the check doesn't fail on XFS, and restrict runtime to
100 loops because otherwise this test takes many hours.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/757 | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/generic/757 b/tests/generic/757
index 0ff5a8ac00182b..37cf49e6bc7fd9 100755
--- a/tests/generic/757
+++ b/tests/generic/757
@@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
cur=$(_log_writes_find_next_fua $prev)
[ -z "$cur" ] && _fail "failed to locate next FUA write"
-while [ ! -z "$cur" ]; do
+while _soak_loop_running $((100 * TIME_FACTOR)); do
_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
+ # xfs_repair won't run if the log is dirty
+ if [ $FSTYP = "xfs" ]; then
+ _scratch_mount
+ _scratch_unmount
+ fi
_check_scratch_fs
prev=$cur
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH 01/16] generic/757: fix various bugs in this test
2024-11-26 1:20 ` [PATCH 01/16] generic/757: fix various bugs in this test Darrick J. Wong
@ 2024-11-28 7:56 ` Zorro Lang
0 siblings, 0 replies; 26+ messages in thread
From: Zorro Lang @ 2024-11-28 7:56 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: fstests, linux-xfs
On Mon, Nov 25, 2024 at 05:20:47PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Fix this test so the check doesn't fail on XFS, and restrict runtime to
> 100 loops because otherwise this test takes many hours.
>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
Thanks, this patchset looks good to me now.
Reviewed-by: Zorro Lang <zlang@redhat.com>
> tests/generic/757 | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>
> diff --git a/tests/generic/757 b/tests/generic/757
> index 0ff5a8ac00182b..37cf49e6bc7fd9 100755
> --- a/tests/generic/757
> +++ b/tests/generic/757
> @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
> cur=$(_log_writes_find_next_fua $prev)
> [ -z "$cur" ] && _fail "failed to locate next FUA write"
>
> -while [ ! -z "$cur" ]; do
> +while _soak_loop_running $((100 * TIME_FACTOR)); do
> _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
>
> + # xfs_repair won't run if the log is dirty
> + if [ $FSTYP = "xfs" ]; then
> + _scratch_mount
> + _scratch_unmount
> + fi
> _check_scratch_fs
>
> prev=$cur
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 02/16] generic/757: convert to thinp
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
2024-11-26 1:20 ` [PATCH 01/16] generic/757: fix various bugs in this test Darrick J. Wong
@ 2024-11-26 1:21 ` Darrick J. Wong
2024-11-28 8:08 ` Zorro Lang
2024-11-26 1:21 ` [PATCH 03/16] xfs/113: fix failure to corrupt the entire directory Darrick J. Wong
` (14 subsequent siblings)
16 siblings, 1 reply; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:21 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Convert this test to use dm-thinp so that discards always zero the data.
This prevents weird replay problems if the scratch device doesn't
guarantee that read after discard returns zeroes.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/757 | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/tests/generic/757 b/tests/generic/757
index 37cf49e6bc7fd9..6c13c6af41c57c 100755
--- a/tests/generic/757
+++ b/tests/generic/757
@@ -8,12 +8,13 @@
# This can be seen on subpage FSes on Linux 6.4.
#
. ./common/preamble
-_begin_fstest auto quick metadata log recoveryloop aio
+_begin_fstest auto quick metadata log recoveryloop aio thin
_cleanup()
{
cd /
_log_writes_cleanup &> /dev/null
+ _dmthin_cleanup
rm -f $tmp.*
}
@@ -23,11 +24,14 @@ _cleanup()
fio_config=$tmp.fio
+. ./common/dmthin
. ./common/dmlogwrites
-_require_scratch
+# Use thin device as replay device, which requires $SCRATCH_DEV
+_require_scratch_nocheck
_require_aiodio
_require_log_writes
+_require_dm_target thin-pool
cat >$fio_config <<EOF
[global]
@@ -47,7 +51,13 @@ _require_fio $fio_config
cat $fio_config >> $seqres.full
-_log_writes_init $SCRATCH_DEV
+# Use a thin device to provide deterministic discard behavior. Discards are used
+# by the log replay tool for fast zeroing to prevent out-of-order replay issues.
+_test_unmount
+sectors=$(blockdev --getsz $SCRATCH_DEV)
+sectors=$((sectors * 90 / 100))
+_dmthin_init $sectors $sectors
+_log_writes_init $DMTHIN_VOL_DEV
_log_writes_mkfs >> $seqres.full 2>&1
_log_writes_mark mkfs
@@ -64,14 +74,13 @@ cur=$(_log_writes_find_next_fua $prev)
[ -z "$cur" ] && _fail "failed to locate next FUA write"
while _soak_loop_running $((100 * TIME_FACTOR)); do
- _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
+ _log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
# xfs_repair won't run if the log is dirty
if [ $FSTYP = "xfs" ]; then
- _scratch_mount
- _scratch_unmount
+ _dmthin_mount
fi
- _check_scratch_fs
+ _dmthin_check_fs
prev=$cur
cur=$(_log_writes_find_next_fua $(($cur + 1)))
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH 02/16] generic/757: convert to thinp
2024-11-26 1:21 ` [PATCH 02/16] generic/757: convert to thinp Darrick J. Wong
@ 2024-11-28 8:08 ` Zorro Lang
0 siblings, 0 replies; 26+ messages in thread
From: Zorro Lang @ 2024-11-28 8:08 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: hch, fstests, linux-xfs
On Mon, Nov 25, 2024 at 05:21:03PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Convert this test to use dm-thinp so that discards always zero the data.
> This prevents weird replay problems if the scratch device doesn't
> guarantee that read after discard returns zeroes.
>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
This patch is good to me, and g/757 finally passed on my side :)
Reviewed-by: Zorro Lang <zlang@redhat.com>
Thanks,
Zorro
> tests/generic/757 | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
>
> diff --git a/tests/generic/757 b/tests/generic/757
> index 37cf49e6bc7fd9..6c13c6af41c57c 100755
> --- a/tests/generic/757
> +++ b/tests/generic/757
> @@ -8,12 +8,13 @@
> # This can be seen on subpage FSes on Linux 6.4.
> #
> . ./common/preamble
> -_begin_fstest auto quick metadata log recoveryloop aio
> +_begin_fstest auto quick metadata log recoveryloop aio thin
>
> _cleanup()
> {
> cd /
> _log_writes_cleanup &> /dev/null
> + _dmthin_cleanup
> rm -f $tmp.*
> }
>
> @@ -23,11 +24,14 @@ _cleanup()
>
> fio_config=$tmp.fio
>
> +. ./common/dmthin
> . ./common/dmlogwrites
>
> -_require_scratch
> +# Use thin device as replay device, which requires $SCRATCH_DEV
> +_require_scratch_nocheck
> _require_aiodio
> _require_log_writes
> +_require_dm_target thin-pool
>
> cat >$fio_config <<EOF
> [global]
> @@ -47,7 +51,13 @@ _require_fio $fio_config
>
> cat $fio_config >> $seqres.full
>
> -_log_writes_init $SCRATCH_DEV
> +# Use a thin device to provide deterministic discard behavior. Discards are used
> +# by the log replay tool for fast zeroing to prevent out-of-order replay issues.
> +_test_unmount
> +sectors=$(blockdev --getsz $SCRATCH_DEV)
> +sectors=$((sectors * 90 / 100))
> +_dmthin_init $sectors $sectors
> +_log_writes_init $DMTHIN_VOL_DEV
> _log_writes_mkfs >> $seqres.full 2>&1
> _log_writes_mark mkfs
>
> @@ -64,14 +74,13 @@ cur=$(_log_writes_find_next_fua $prev)
> [ -z "$cur" ] && _fail "failed to locate next FUA write"
>
> while _soak_loop_running $((100 * TIME_FACTOR)); do
> - _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
> + _log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
>
> # xfs_repair won't run if the log is dirty
> if [ $FSTYP = "xfs" ]; then
> - _scratch_mount
> - _scratch_unmount
> + _dmthin_mount
> fi
> - _check_scratch_fs
> + _dmthin_check_fs
>
> prev=$cur
> cur=$(_log_writes_find_next_fua $(($cur + 1)))
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 03/16] xfs/113: fix failure to corrupt the entire directory
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
2024-11-26 1:20 ` [PATCH 01/16] generic/757: fix various bugs in this test Darrick J. Wong
2024-11-26 1:21 ` [PATCH 02/16] generic/757: convert to thinp Darrick J. Wong
@ 2024-11-26 1:21 ` Darrick J. Wong
2024-11-26 1:21 ` [PATCH 04/16] xfs/508: fix test for 64k blocksize Darrick J. Wong
` (13 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:21 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
This test tries to corrupt the data blocks of a directory, but it
doesn't take into account the fact that __populate_check_xfs_dir can
remove enough entries to cause sparse holes in the directory. If that
happens, this "file data block is unmapped" logic will cause the
corruption loop to exit early. Then we can add to the directory, which
causes the test to fail.
Instead, create a list of mappable dir block offsets, and run 100
corruptions at a time to reduce the amount of time we spend initializing
xfs_db. This fixes the regressions that I see with 32k/64k block sizes.
Cc: <fstests@vger.kernel.org> # v2022.05.01
Fixes: c8e6dbc8812653 ("xfs: test directory metadata corruption checking and repair")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/113 | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/tests/xfs/113 b/tests/xfs/113
index 094ab71f2aefec..22ac8c3fd51b80 100755
--- a/tests/xfs/113
+++ b/tests/xfs/113
@@ -52,13 +52,34 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
echo "+ check dir"
__populate_check_xfs_dir "${inode}" btree
+dir_data_offsets() {
+ _scratch_xfs_db -c "inode ${inode}" -c 'bmap' | \
+ awk -v leaf_lblk=$leaf_lblk \
+ '{
+ if ($3 >= leaf_lblk)
+ exit;
+ for (i = 0; i < $8; i++)
+ printf("%d\n", $3 + i);
+ }'
+}
+
echo "+ corrupt dir"
-loff=0
-while true; do
- _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break
- _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
- loff="$((loff + 1))"
-done
+subcommands=()
+while read loff; do
+ # run 100 commands at a time
+ if [ "${#subcommands[@]}" -lt 600 ]; then
+ subcommands+=(-c "inode ${inode}")
+ subcommands+=(-c "dblock ${loff}")
+ subcommands+=(-c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}")
+ continue
+ fi
+
+ _scratch_xfs_db -x "${subcommands[@]}" >> $seqres.full
+ subcommands=()
+done < <(dir_data_offsets)
+if [ "${#subcommands[@]}" -gt 0 ]; then
+ _scratch_xfs_db -x "${subcommands[@]}" >> $seqres.full
+fi
echo "+ mount image && modify dir"
if _try_scratch_mount >> $seqres.full 2>&1; then
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 04/16] xfs/508: fix test for 64k blocksize
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (2 preceding siblings ...)
2024-11-26 1:21 ` [PATCH 03/16] xfs/113: fix failure to corrupt the entire directory Darrick J. Wong
@ 2024-11-26 1:21 ` Darrick J. Wong
2024-11-26 1:21 ` [PATCH 05/16] common/rc: capture dmesg when oom kills happen Darrick J. Wong
` (12 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:21 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
It turns out that icreate transactions will try to reserve quite a bit
of space on a 64k fsblock filesystem -- enough to handle the worst case
parent directory expansion, a new inode chunk, and these days a parent
pointer as well. This can work out to quite a bit of space:
fsblock reservation
1k 172K
4k 368K
16k 1136K
64k 3650K
Unfortunately, this test sets its block quota limits at 1-2MB, so we
can't even create a child file. Bump the limits up by 10x so that this
test will pass even if there's more metadata size creep in the future.
Fixes: f769a923f576df ("xfs: project quota ineritance flag test")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/508 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/xfs/508 b/tests/xfs/508
index ee1a0371db7d6d..1bd13e98c9f641 100755
--- a/tests/xfs/508
+++ b/tests/xfs/508
@@ -44,7 +44,7 @@ do_quota_nospc()
local exp=$2
echo "Write $file, expect $exp:" | _filter_scratch
- $XFS_IO_PROG -t -f -c "pwrite 0 5m" $file 2>&1 >/dev/null | \
+ $XFS_IO_PROG -t -f -c "pwrite 0 50m" $file 2>&1 >/dev/null | \
_filter_xfs_io_error
rm -f $file
}
@@ -56,7 +56,7 @@ _require_prjquota $SCRATCH_DEV
mkdir $SCRATCH_MNT/dir
$QUOTA_CMD -x -c 'project -s test' $SCRATCH_MNT >>$seqres.full 2>&1
-$QUOTA_CMD -x -c 'limit -p bsoft=1m bhard=2m test' $SCRATCH_MNT
+$QUOTA_CMD -x -c 'limit -p bsoft=10m bhard=20m test' $SCRATCH_MNT
# test the Project inheritance bit is a directory only flag, and it's set on
# directory by default. Expect no complain about "project inheritance flag is
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 05/16] common/rc: capture dmesg when oom kills happen
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (3 preceding siblings ...)
2024-11-26 1:21 ` [PATCH 04/16] xfs/508: fix test for 64k blocksize Darrick J. Wong
@ 2024-11-26 1:21 ` Darrick J. Wong
2024-11-26 1:22 ` [PATCH 06/16] generic/562: handle ENOSPC while cloning gracefully Darrick J. Wong
` (11 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:21 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Capture the dmesg output if the OOM killer is invoked during fstests.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
common/rc | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/rc b/common/rc
index 2ee46e5101e168..70a0f1d1c6acd9 100644
--- a/common/rc
+++ b/common/rc
@@ -4538,6 +4538,7 @@ _check_dmesg()
-e "INFO: possible circular locking dependency detected" \
-e "general protection fault:" \
-e "BUG .* remaining" \
+ -e "oom-kill" \
-e "UBSAN:" \
$seqres.dmesg
if [ $? -eq 0 ]; then
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 06/16] generic/562: handle ENOSPC while cloning gracefully
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (4 preceding siblings ...)
2024-11-26 1:21 ` [PATCH 05/16] common/rc: capture dmesg when oom kills happen Darrick J. Wong
@ 2024-11-26 1:22 ` Darrick J. Wong
2024-11-26 4:55 ` Christoph Hellwig
2024-11-26 1:22 ` [PATCH 07/16] xfs/163: skip test if we can't shrink due to enospc issues Darrick J. Wong
` (10 subsequent siblings)
16 siblings, 1 reply; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:22 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
This test creates a couple of patterned files on a tiny filesystem,
fragments the free space, clones one patterned file to the other, and
checks that the entire file was cloned.
However, this test doesn't work on a 64k fsblock filesystem because
we've used up all the free space reservation for the rmapbt, and that
causes the FICLONE to error out with ENOSPC partway through. Hence we
need to detect the ENOSPC and _notrun the test.
That said, it turns out that XFS has been silently dropping error codes
if we managed to make some progress cloning extents. That's ok if the
operation has REMAP_FILE_CAN_SHORTEN like copy_file_range does, but
FICLONE/FICLONERANGE do not permit partial results, so the dropped error
codes is actually an error.
Therefore, this testcase now becomes a regression test for the patch to
fix that.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/generic/562 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/generic/562 b/tests/generic/562
index 91360c4154a6a2..36bd02911c96b8 100755
--- a/tests/generic/562
+++ b/tests/generic/562
@@ -15,6 +15,9 @@ _begin_fstest auto clone punch
. ./common/filter
. ./common/reflink
+test "$FSTYP" = "xfs" && \
+ _fixed_by_kernel_commit XXXXXXXXXX "xfs: don't drop errno values when we fail to ficlone the entire range"
+
_require_scratch_reflink
_require_test_program "punch-alternating"
_require_xfs_io_command "fpunch"
@@ -48,8 +51,11 @@ while true; do
done
# Now clone file bar into file foo. This is supposed to succeed and not fail
-# with ENOSPC for example.
-_reflink $SCRATCH_MNT/bar $SCRATCH_MNT/foo >>$seqres.full
+# with ENOSPC for example. However, XFS will sometimes run out of space.
+_reflink $SCRATCH_MNT/bar $SCRATCH_MNT/foo >>$seqres.full 2> $tmp.err
+cat $tmp.err
+test "$FSTYP" = "xfs" && grep -q 'No space left on device' $tmp.err && \
+ _notrun "ran out of space while cloning"
# Unmount and mount the filesystem again to verify the operation was durably
# persisted.
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH 06/16] generic/562: handle ENOSPC while cloning gracefully
2024-11-26 1:22 ` [PATCH 06/16] generic/562: handle ENOSPC while cloning gracefully Darrick J. Wong
@ 2024-11-26 4:55 ` Christoph Hellwig
0 siblings, 0 replies; 26+ messages in thread
From: Christoph Hellwig @ 2024-11-26 4:55 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs
On Mon, Nov 25, 2024 at 05:22:05PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> This test creates a couple of patterned files on a tiny filesystem,
> fragments the free space, clones one patterned file to the other, and
> checks that the entire file was cloned.
>
> However, this test doesn't work on a 64k fsblock filesystem because
> we've used up all the free space reservation for the rmapbt, and that
> causes the FICLONE to error out with ENOSPC partway through. Hence we
> need to detect the ENOSPC and _notrun the test.
>
> That said, it turns out that XFS has been silently dropping error codes
> if we managed to make some progress cloning extents. That's ok if the
> operation has REMAP_FILE_CAN_SHORTEN like copy_file_range does, but
> FICLONE/FICLONERANGE do not permit partial results, so the dropped error
> codes is actually an error.
>
> Therefore, this testcase now becomes a regression test for the patch to
> fix that.
Still no big fan of having a btrfs-specific must not ENOSPC
assumption in a generic test. So my preference would be to move
the must not error at all case into a btrfs specific test and make
your newly added ENOSPC handling unconditional. But I guess the
state with this patch is strictly better than without, so:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 07/16] xfs/163: skip test if we can't shrink due to enospc issues
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (5 preceding siblings ...)
2024-11-26 1:22 ` [PATCH 06/16] generic/562: handle ENOSPC while cloning gracefully Darrick J. Wong
@ 2024-11-26 1:22 ` Darrick J. Wong
2024-11-26 1:22 ` [PATCH 08/16] xfs/009: allow logically contiguous preallocations Darrick J. Wong
` (9 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:22 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
If this test fails due to insufficient space, skip this test. This can
happen if a realtime volume is enabled on the filesystem and we cannot
shrink due to the rtbitmap.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/163 | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tests/xfs/163 b/tests/xfs/163
index 2bd94060222f96..75c3113dc2fd03 100755
--- a/tests/xfs/163
+++ b/tests/xfs/163
@@ -17,13 +17,20 @@ _begin_fstest auto quick growfs shrinkfs
test_shrink()
{
- $XFS_GROWFS_PROG -D"$1" $SCRATCH_MNT >> $seqres.full 2>&1
+ $XFS_GROWFS_PROG -D"$1" $SCRATCH_MNT &> $tmp.growfs
ret=$?
_scratch_unmount
_check_scratch_fs
_scratch_mount
+ # If we couldn't shrink the filesystem due to lack of space, we're
+ # done with this test.
+ [ $1 -ne $dblocks ] && \
+ grep -q 'No space left on device' $tmp.growfs && \
+ _notrun "Could not shrink due to lack of space"
+ cat $tmp.growfs >> $seqres.full
+
$XFS_INFO_PROG $SCRATCH_MNT 2>&1 | _filter_mkfs 2>$tmp.growfs >/dev/null
. $tmp.growfs
[ $ret -eq 0 -a $1 -eq $dblocks ]
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 08/16] xfs/009: allow logically contiguous preallocations
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (6 preceding siblings ...)
2024-11-26 1:22 ` [PATCH 07/16] xfs/163: skip test if we can't shrink due to enospc issues Darrick J. Wong
@ 2024-11-26 1:22 ` Darrick J. Wong
2024-11-26 1:22 ` [PATCH 09/16] generic/251: use sentinel files to kill the fstrim loop Darrick J. Wong
` (8 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:22 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
The new rtgroups feature implements a simplistic rotor to pick the
rtgroup for an initial allocation to a file. This causes test failures
if the preallocations are spread across two rtgroups, which happens if
there are more subtests than rtgroups.
One way to fix this would be to reset the rotor then each subtest starts
allocating from rtgroup 0, but the only way to do that is to cycle the
scratch mount, which is a bit gross.
Instead, report logically contiguous mappings as a single mapping even
if the physical space is not contiguous. Unfortunately, there's not
enough context in the comments to know if the test actually was checking
for physical contiguity? Or if this is just an exerciser of the old
preallocation calls, and it's fine as long as the file ranges are mapped
(or unmapped) as desired.
Messing with some awk is a lot cheaper than umount/mount cycling.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/009 | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/tests/xfs/009 b/tests/xfs/009
index dde505f079f4f8..bb42ce32490df5 100755
--- a/tests/xfs/009
+++ b/tests/xfs/009
@@ -49,13 +49,26 @@ _filesize()
_block_filter()
{
$AWK_PROG -v bsize="$bsize" '
+ BEGIN {
+ br_pos = 0
+ br_len = 0
+ }
+ function dump_blockrange() {
+ if (br_len == 0)
+ return
+ printf(" [%d,%d]: BLOCKRANGE\n", br_pos, br_len)
+ br_pos = 0
+ br_len = 0
+ }
/blocksize/ {
+ dump_blockrange()
printf(" blocksize BSIZE\n")
next
}
/CMD/ {
+ dump_blockrange()
split($3, off, "=")
offset = strtonum(off[2])
if (offset != -1)
@@ -72,6 +85,7 @@ _block_filter()
}
/MAP/ {
+ dump_blockrange()
split($2, off, "=")
offset = strtonum(off[2])
if (offset != -1)
@@ -90,6 +104,7 @@ _block_filter()
}
/TRUNCATE/ {
+ dump_blockrange()
split($2, off, "=")
offset = strtonum(off[2]) / bsize
@@ -99,16 +114,28 @@ _block_filter()
}
/\[[0-9]+,[0-9]+\]:/ {
- printf(" %s BLOCKRANGE\n", $1)
+ rangestr = gensub(/\[([0-9]+),([0-9]+)\]:/, "\\1,\\2", "g", $1);
+ split(rangestr, off, ",")
+ if (br_pos + br_len == off[1]) {
+ br_len += off[2];
+ } else {
+ dump_blockrange()
+ br_pos = off[1];
+ br_len = off[2];
+ }
next
}
{
+ dump_blockrange()
print
next
}
+ END {
+ dump_blockrange()
+ }
'
}
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 09/16] generic/251: use sentinel files to kill the fstrim loop
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (7 preceding siblings ...)
2024-11-26 1:22 ` [PATCH 08/16] xfs/009: allow logically contiguous preallocations Darrick J. Wong
@ 2024-11-26 1:22 ` Darrick J. Wong
2024-11-26 1:23 ` [PATCH 10/16] generic/251: constrain runtime via time/load/soak factors Darrick J. Wong
` (7 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:22 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Apparently the subshell kill doesn't always take, and then the test runs
for hours and hours because nothing stops it. Instead, use a sentinel
file to detect when fstrim_loop should stop execing background fstrims.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/251 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/generic/251 b/tests/generic/251
index b432fb11937911..d59e91c3e0a33a 100755
--- a/tests/generic/251
+++ b/tests/generic/251
@@ -125,12 +125,15 @@ fstrim_loop()
wait $fpid
fi
while [ $start -lt $fsize ] ; do
+ test -s $tmp.fstrim_loop || break
$FSTRIM_PROG -m ${minlen}k -o ${start}k -l ${step}k $SCRATCH_MNT &
fpid=$!
wait $fpid
start=$(( $start + $step ))
done
+ test -s $tmp.fstrim_loop || break
done
+ rm -f $tmp.fstrim_loop
}
function check_sums() {
@@ -188,6 +191,7 @@ find -P . -xdev -type f -print0 | xargs -0 md5sum | sort -o $tmp/content.sums
echo -n "Running the test: "
pids=""
+echo run > $tmp.fstrim_loop
fstrim_loop &
fstrim_pid=$!
p=1
@@ -199,8 +203,10 @@ done
echo "done."
wait $pids
-kill $fstrim_pid
-wait $fstrim_pid
+truncate -s 0 $tmp.fstrim_loop
+while test -e $tmp.fstrim_loop; do
+ sleep 1
+done
status=0
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 10/16] generic/251: constrain runtime via time/load/soak factors
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (8 preceding siblings ...)
2024-11-26 1:22 ` [PATCH 09/16] generic/251: use sentinel files to kill the fstrim loop Darrick J. Wong
@ 2024-11-26 1:23 ` Darrick J. Wong
2024-11-26 1:23 ` [PATCH 11/16] generic/251: don't copy the fsstress source code Darrick J. Wong
` (6 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:23 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
On my test fleet, this test can run for well in excess of 20 minutes:
613 generic/251
616 generic/251
624 generic/251
630 generic/251
634 generic/251
652 generic/251
675 generic/251
749 generic/251
777 generic/251
808 generic/251
832 generic/251
946 generic/251
1082 generic/251
1221 generic/251
1241 generic/251
1254 generic/251
1305 generic/251
1366 generic/251
1646 generic/251
1936 generic/251
1952 generic/251
2358 generic/251
4359 generic/251
5325 generic/251
34046 generic/251
because it hardcodes 20 threads and 10 copies. It's not great to have a
test that results in a significant fraction of the total test runtime.
Fix the looping and load on this test to use LOAD and TIME_FACTOR to
scale up its operations, along with the usual SOAK_DURATION override.
That brings the default runtime down to less than a minute.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/251 | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/tests/generic/251 b/tests/generic/251
index d59e91c3e0a33a..b4ddda10cef403 100755
--- a/tests/generic/251
+++ b/tests/generic/251
@@ -15,7 +15,6 @@ _begin_fstest ioctl trim auto
tmp=`mktemp -d`
trap "_cleanup; exit \$status" 0 1 3
trap "_destroy; exit \$status" 2 15
-chpid=0
mypid=$$
# Import common functions.
@@ -151,29 +150,28 @@ function check_sums() {
function run_process() {
local p=$1
- repeat=10
+ if [ -n "$SOAK_DURATION" ]; then
+ local duration="$SOAK_DURATION"
+ else
+ local duration="$((30 * TIME_FACTOR))"
+ fi
+ local stopat="$(( $(date +%s) + duration))"
- sleep $((5*$p))s &
- export chpid=$! && wait $chpid &> /dev/null
- chpid=0
-
- while [ $repeat -gt 0 ]; do
+ sleep $((5*$p))s
+ while [ "$(date +%s)" -lt "$stopat" ]; do
# Remove old directories.
rm -rf $SCRATCH_MNT/$p
- export chpid=$! && wait $chpid &> /dev/null
# Copy content -> partition.
mkdir $SCRATCH_MNT/$p
cp -axT $content/ $SCRATCH_MNT/$p/
- export chpid=$! && wait $chpid &> /dev/null
check_sums
- repeat=$(( $repeat - 1 ))
done
}
-nproc=20
+nproc=$((4 * LOAD_FACTOR))
# Copy $here to the scratch fs and make coipes of the replica. The fstests
# output (and hence $seqres.full) could be in $here, so we need to snapshot
@@ -194,11 +192,9 @@ pids=""
echo run > $tmp.fstrim_loop
fstrim_loop &
fstrim_pid=$!
-p=1
-while [ $p -le $nproc ]; do
+for ((p = 1; p < nproc; p++)); do
run_process $p &
pids="$pids $!"
- p=$(($p+1))
done
echo "done."
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 11/16] generic/251: don't copy the fsstress source code
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (9 preceding siblings ...)
2024-11-26 1:23 ` [PATCH 10/16] generic/251: constrain runtime via time/load/soak factors Darrick J. Wong
@ 2024-11-26 1:23 ` Darrick J. Wong
2024-11-26 1:23 ` [PATCH 12/16] common/rc: _scratch_mkfs_sized supports extra arguments Darrick J. Wong
` (5 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:23 UTC (permalink / raw)
To: djwong, zlang; +Cc: hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Run fsstress for a short time to generate test data to replicate on the
scratch device so that we don't blow out the test runtimes on
unintentionally copying .git directories or large corefiles from the
developer's systems, etc.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/251 | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tests/generic/251 b/tests/generic/251
index b4ddda10cef403..ec486c277c6828 100755
--- a/tests/generic/251
+++ b/tests/generic/251
@@ -173,13 +173,11 @@ function run_process() {
nproc=$((4 * LOAD_FACTOR))
-# Copy $here to the scratch fs and make coipes of the replica. The fstests
-# output (and hence $seqres.full) could be in $here, so we need to snapshot
-# $here before computing file checksums.
+# Use fsstress to create a directory tree with some variability
content=$SCRATCH_MNT/orig
mkdir -p $content
-cp -axT $here/ $content/
-
+FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $content -n 1000 $FSSTRESS_AVOID)
+$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
mkdir -p $tmp
(
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 12/16] common/rc: _scratch_mkfs_sized supports extra arguments
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (10 preceding siblings ...)
2024-11-26 1:23 ` [PATCH 11/16] generic/251: don't copy the fsstress source code Darrick J. Wong
@ 2024-11-26 1:23 ` Darrick J. Wong
2024-11-26 1:23 ` [PATCH 13/16] xfs/157: do not drop necessary mkfs options Darrick J. Wong
` (4 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:23 UTC (permalink / raw)
To: djwong, zlang; +Cc: zlang, fstests, linux-xfs
From: Zorro Lang <zlang@kernel.org>
To give more arguments to _scratch_mkfs_sized, we generally do as:
MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size
to give "-L oldlabel" to it. But if _scratch_mkfs_sized fails, it
will get rid of the whole MKFS_OPTIONS and try to mkfs again.
Likes:
** mkfs failed with extra mkfs options added to "-L oldlabel -m rmapbt=1" by test 157 **
** attempting to mkfs using only test 157 options: -d size=524288000 -b size=4096 **
But that's not the fault of "-L oldlabel". So for keeping the mkfs
options ("-L oldlabel") we need, we'd better to let the
scratch_mkfs_sized to support extra arguments, rather than using
global MKFS_OPTIONS.
Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
[djwong: fix string quoting issues]
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
common/rc | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/common/rc b/common/rc
index 70a0f1d1c6acd9..6acacbe4c88eea 100644
--- a/common/rc
+++ b/common/rc
@@ -1026,11 +1026,13 @@ _small_fs_size_mb()
}
# Create fs of certain size on scratch device
-# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize] [other options]
_try_scratch_mkfs_sized()
{
local fssize=$1
- local blocksize=$2
+ shift
+ local blocksize=$1
+ shift
local def_blksz
local blocksize_opt
local rt_ops
@@ -1094,10 +1096,10 @@ _try_scratch_mkfs_sized()
# don't override MKFS_OPTIONS that set a block size.
echo $MKFS_OPTIONS |grep -E -q "b\s*size="
if [ $? -eq 0 ]; then
- _try_scratch_mkfs_xfs -d size=$fssize $rt_ops
+ _try_scratch_mkfs_xfs -d size=$fssize $rt_ops "$@"
else
_try_scratch_mkfs_xfs -d size=$fssize $rt_ops \
- -b size=$blocksize
+ -b size=$blocksize "$@"
fi
;;
ext2|ext3|ext4)
@@ -1108,7 +1110,7 @@ _try_scratch_mkfs_sized()
_notrun "Could not make scratch logdev"
MKFS_OPTIONS="$MKFS_OPTIONS -J device=$SCRATCH_LOGDEV"
fi
- ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+ ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks
;;
gfs2)
# mkfs.gfs2 doesn't automatically shrink journal files on small
@@ -1123,13 +1125,13 @@ _try_scratch_mkfs_sized()
(( journal_size >= min_journal_size )) || journal_size=$min_journal_size
MKFS_OPTIONS="-J $journal_size $MKFS_OPTIONS"
fi
- ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV $blocks
+ ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize "$@" $SCRATCH_DEV $blocks
;;
ocfs2)
- yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+ yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks
;;
udf)
- $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+ $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks
;;
btrfs)
local mixed_opt=
@@ -1137,33 +1139,33 @@ _try_scratch_mkfs_sized()
# the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size()
(( fssize < $((256 * 1024 * 1024)) )) &&
! _scratch_btrfs_is_zoned && mixed_opt='--mixed'
- $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
+ $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV
;;
jfs)
- ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS $SCRATCH_DEV $blocks
+ ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocks
;;
reiserfs)
- ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+ ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks
;;
reiser4)
# mkfs.resier4 requires size in KB as input for creating filesystem
- $MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \
+ $MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize "$@" $SCRATCH_DEV \
`expr $fssize / 1024`
;;
f2fs)
# mkfs.f2fs requires # of sectors as an input for the size
local sector_size=`blockdev --getss $SCRATCH_DEV`
- $MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / $sector_size`
+ $MKFS_F2FS_PROG $MKFS_OPTIONS "$@" $SCRATCH_DEV `expr $fssize / $sector_size`
;;
tmpfs)
local free_mem=`_free_memory_bytes`
if [ "$free_mem" -lt "$fssize" ] ; then
_notrun "Not enough memory ($free_mem) for tmpfs with $fssize bytes"
fi
- export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
+ export MOUNT_OPTIONS="-o size=$fssize "$@" $TMPFS_MOUNT_OPTIONS"
;;
bcachefs)
- $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt $SCRATCH_DEV
+ $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt "$@" $SCRATCH_DEV
;;
*)
_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
@@ -1173,7 +1175,7 @@ _try_scratch_mkfs_sized()
_scratch_mkfs_sized()
{
- _try_scratch_mkfs_sized $* || _notrun "_scratch_mkfs_sized failed with ($*)"
+ _try_scratch_mkfs_sized "$@" || _notrun "_scratch_mkfs_sized failed with ($*)"
}
# Emulate an N-data-disk stripe w/ various stripe units
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 13/16] xfs/157: do not drop necessary mkfs options
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (11 preceding siblings ...)
2024-11-26 1:23 ` [PATCH 12/16] common/rc: _scratch_mkfs_sized supports extra arguments Darrick J. Wong
@ 2024-11-26 1:23 ` Darrick J. Wong
2024-11-26 1:24 ` [PATCH 14/16] generic/366: fix directio requirements checking Darrick J. Wong
` (3 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:23 UTC (permalink / raw)
To: djwong, zlang; +Cc: zlang, fstests, linux-xfs
From: Zorro Lang <zlang@kernel.org>
To give the test option "-L oldlabel" to _scratch_mkfs_sized, xfs/157
does:
MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size
but the _scratch_mkfs_sized trys to keep the $fs_size, when mkfs
fails with incompatible $MKFS_OPTIONS options, likes this:
** mkfs failed with extra mkfs options added to "-L oldlabel -m rmapbt=1" by test 157 **
** attempting to mkfs using only test 157 options: -d size=524288000 -b size=4096 **
but the "-L oldlabel" is necessary, we shouldn't drop it. To avoid
that, we give the "-L oldlabel" to _scratch_mkfs_sized through
function parameters, not through global MKFS_OPTIONS.
Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
[djwong: fix more string quoting issues]
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/xfs/157 | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/xfs/157 b/tests/xfs/157
index 9b5badbaeb3c76..e102a5a10abe4b 100755
--- a/tests/xfs/157
+++ b/tests/xfs/157
@@ -66,8 +66,7 @@ scenario() {
}
check_label() {
- MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size \
- >> $seqres.full
+ _scratch_mkfs_sized "$fs_size" "" -L oldlabel >> $seqres.full 2>&1
_scratch_xfs_db -c label
_scratch_xfs_admin -L newlabel "$@" >> $seqres.full
_scratch_xfs_db -c label
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 14/16] generic/366: fix directio requirements checking
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (12 preceding siblings ...)
2024-11-26 1:23 ` [PATCH 13/16] xfs/157: do not drop necessary mkfs options Darrick J. Wong
@ 2024-11-26 1:24 ` Darrick J. Wong
2024-11-26 1:24 ` [PATCH 15/16] generic/454: actually set attr value for llamapirate subtest Darrick J. Wong
` (2 subsequent siblings)
16 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:24 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, hch, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
On a system with 4k-sector storage devices, this test fails with:
--- /tmp/fstests/tests/generic/366.out 2024-11-17 09:04:53.161104479 -0800
+++ /var/tmp/fstests/generic/366.out.bad 2024-11-20 21:02:30.948000000 -0800
@@ -1,2 +1,34 @@
QA output created by 366
+fio: io_u error on file /opt/file1: Invalid argument: read offset=15360, buflen=512
+fio: io_u error on file /opt/file1: Invalid argument: read offset=15360, buflen=512
The cause of this failure is that we cannot do 512byte directios to a
device with 4k LBAs. Update the precondition checking to exclude this
scenario.
Cc: <fstests@vger.kernel.org> # v2024.11.17
Fixes: 4c1629ae3a3a56 ("generic: new test case to verify if certain fio load will hang the filesystem")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/366 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/generic/366 b/tests/generic/366
index 6e7dd7279218c4..b322bcca72fecc 100755
--- a/tests/generic/366
+++ b/tests/generic/366
@@ -20,7 +20,7 @@ _begin_fstest auto quick rw
. ./common/filter
_require_scratch
-_require_odirect
+_require_odirect 512 # see fio job1 config below
_require_aio
_fixed_by_kernel_commit xxxxxxxxxxxx \
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 15/16] generic/454: actually set attr value for llamapirate subtest
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (13 preceding siblings ...)
2024-11-26 1:24 ` [PATCH 14/16] generic/366: fix directio requirements checking Darrick J. Wong
@ 2024-11-26 1:24 ` Darrick J. Wong
2024-11-26 4:56 ` Christoph Hellwig
2024-11-26 1:24 ` [PATCH 16/16] xfs/122: add tests for commitrange structures Darrick J. Wong
2024-11-26 20:27 ` [PATCH 17/16] generic/459: prevent collisions between test VMs backed by a shared disk pool Darrick J. Wong
16 siblings, 1 reply; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:24 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, tytso, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Ted reported that this test fails on his setup, and I noticed that I
forgot to actually set a value for the xattr. In theory filesystems
support zero-byte xattrs, but we might as well set and check the values
so that we can make sure nobody got confused.
The actual test failure comes from attr 2.4.47 refusing to set a
zero-legnth xattr, whereas 2.5 and newer will. That was changed in the
attr commit 0550d2bc989d39 ("Properly set and report empty attribute
values") prior to 2.4.48:
https://git.savannah.nongnu.org/cgit/attr.git/commit/?id=0550d2bc989d390eb25f7004ee0fae2dbc693a0d
Cc: <fstests@vger.kernel.org> # v2024.10.28
Fixes: 9c3762ceafd430 ("misc: amend unicode confusing name tests to check for hidden tag characters")
Reported-and-tested-by: tytso@mit.edu
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/generic/454 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/generic/454 b/tests/generic/454
index 2cc2d81ce4cc77..aec8beb8b43ca0 100755
--- a/tests/generic/454
+++ b/tests/generic/454
@@ -121,8 +121,8 @@ setf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
setf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
# encoding hidden tag characters in attrnames to create confusing xattrs
-setf "llamapirate\xf3\xa0\x80\x81\xf3\xa0\x81\x94\xf3\xa0\x81\xa8\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb3\xf3\xa0\x81\xa1\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x81\xb3\xf3\xa0\x80\xa0\xf3\xa0\x81\xa6\xf3\xa0\x81\xaf\xf3\xa0\x81\xb2\xf3\xa0\x80\xa0\xf3\xa0\x81\x93\xf3\xa0\x81\xa5\xf3\xa0\x81\xa1\xf3\xa0\x81\xb4\xf3\xa0\x81\xb4\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb7\xf3\xa0\x81\xa5\xf3\xa0\x81\xb2\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\x95\xf3\xa0\x81\x93\xf3\xa0\x81\x84\xf3\xa0\x80\xa0\xf3\xa0\x80\xb1\xf3\xa0\x80\xb2\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x81\xbf"
-setf "llamapirate"
+setf "llamapirate\xf3\xa0\x80\x81\xf3\xa0\x81\x94\xf3\xa0\x81\xa8\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb3\xf3\xa0\x81\xa1\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x81\xb3\xf3\xa0\x80\xa0\xf3\xa0\x81\xa6\xf3\xa0\x81\xaf\xf3\xa0\x81\xb2\xf3\xa0\x80\xa0\xf3\xa0\x81\x93\xf3\xa0\x81\xa5\xf3\xa0\x81\xa1\xf3\xa0\x81\xb4\xf3\xa0\x81\xb4\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb7\xf3\xa0\x81\xa5\xf3\xa0\x81\xb2\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\x95\xf3\xa0\x81\x93\xf3\xa0\x81\x84\xf3\xa0\x80\xa0\xf3\xa0\x80\xb1\xf3\xa0\x80\xb2\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x81\xbf" "secret instructions"
+setf "llamapirate" "no secret instructions"
_getfattr --absolute-names -d "${testfile}" >> $seqres.full
@@ -171,8 +171,8 @@ testf "zerojoin_moo\xe2\x80\x8ccow.txt" "zero width joiners"
testf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
testf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
-testf "llamapirate\xf3\xa0\x80\x81\xf3\xa0\x81\x94\xf3\xa0\x81\xa8\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb3\xf3\xa0\x81\xa1\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x81\xb3\xf3\xa0\x80\xa0\xf3\xa0\x81\xa6\xf3\xa0\x81\xaf\xf3\xa0\x81\xb2\xf3\xa0\x80\xa0\xf3\xa0\x81\x93\xf3\xa0\x81\xa5\xf3\xa0\x81\xa1\xf3\xa0\x81\xb4\xf3\xa0\x81\xb4\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb7\xf3\xa0\x81\xa5\xf3\xa0\x81\xb2\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\x95\xf3\xa0\x81\x93\xf3\xa0\x81\x84\xf3\xa0\x80\xa0\xf3\xa0\x80\xb1\xf3\xa0\x80\xb2\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x81\xbf"
-testf "llamapirate"
+testf "llamapirate\xf3\xa0\x80\x81\xf3\xa0\x81\x94\xf3\xa0\x81\xa8\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb3\xf3\xa0\x81\xa1\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x81\xb3\xf3\xa0\x80\xa0\xf3\xa0\x81\xa6\xf3\xa0\x81\xaf\xf3\xa0\x81\xb2\xf3\xa0\x80\xa0\xf3\xa0\x81\x93\xf3\xa0\x81\xa5\xf3\xa0\x81\xa1\xf3\xa0\x81\xb4\xf3\xa0\x81\xb4\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb7\xf3\xa0\x81\xa5\xf3\xa0\x81\xb2\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\x95\xf3\xa0\x81\x93\xf3\xa0\x81\x84\xf3\xa0\x80\xa0\xf3\xa0\x80\xb1\xf3\xa0\x80\xb2\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x81\xbf" "secret instructions"
+testf "llamapirate" "no secret instructions"
echo "Uniqueness of keys?"
crazy_keys="$(_getfattr --absolute-names -d "${testfile}" | grep -E -c '(french_|chinese_|greek_|arabic_|urk)')"
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH 16/16] xfs/122: add tests for commitrange structures
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (14 preceding siblings ...)
2024-11-26 1:24 ` [PATCH 15/16] generic/454: actually set attr value for llamapirate subtest Darrick J. Wong
@ 2024-11-26 1:24 ` Darrick J. Wong
2024-11-26 4:57 ` Christoph Hellwig
2024-11-26 20:27 ` [PATCH 17/16] generic/459: prevent collisions between test VMs backed by a shared disk pool Darrick J. Wong
16 siblings, 1 reply; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 1:24 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE,
which was added in 6.12. This will be the last ever addition to
xfs/122, because in 6.13 we moved the ondisk structure checks to libxfs
after which we'll be able to _notrun this test on newer codebases.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/xfs/122.out | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 60d8294551b1c8..4dc7d7d0a3602b 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -76,6 +76,7 @@ sizeof(struct xfs_bulk_ireq) = 64
sizeof(struct xfs_bulkstat) = 192
sizeof(struct xfs_bulkstat_req) = 64
sizeof(struct xfs_clone_args) = 32
+sizeof(struct xfs_commit_range) = 88
sizeof(struct xfs_cud_log_format) = 16
sizeof(struct xfs_cui_log_format) = 16
sizeof(struct xfs_da3_blkinfo) = 56
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH 16/16] xfs/122: add tests for commitrange structures
2024-11-26 1:24 ` [PATCH 16/16] xfs/122: add tests for commitrange structures Darrick J. Wong
@ 2024-11-26 4:57 ` Christoph Hellwig
0 siblings, 0 replies; 26+ messages in thread
From: Christoph Hellwig @ 2024-11-26 4:57 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs
On Mon, Nov 25, 2024 at 05:24:43PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE,
> which was added in 6.12. This will be the last ever addition to
> xfs/122, because in 6.13 we moved the ondisk structure checks to libxfs
> after which we'll be able to _notrun this test on newer codebases.
As we'd say in german: Dein Wort in Gottes Ohr!
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 17/16] generic/459: prevent collisions between test VMs backed by a shared disk pool
2024-11-26 1:20 ` [PATCHSET v3] fstests: random fixes for v2024.11.17 Darrick J. Wong
` (15 preceding siblings ...)
2024-11-26 1:24 ` [PATCH 16/16] xfs/122: add tests for commitrange structures Darrick J. Wong
@ 2024-11-26 20:27 ` Darrick J. Wong
2024-11-27 5:43 ` Christoph Hellwig
16 siblings, 1 reply; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-26 20:27 UTC (permalink / raw)
To: zlang; +Cc: zlang, fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
If you happen to be running fstests on a bunch of VMs and the VMs all
have access to a shared disk pool, then it's possible that two VMs could
be running generic/459 at exactly the same time. In that case, it's a
VERY bad thing to have two nodes trying to create an LVM volume group
named "vg_459" because one node will succeed, after which the other node
will see the vg_459 volume group that it didn't create:
A volume group called vg_459 already exists.
Logical volume pool_459 already exists in Volume group vg_459.
Logical Volume "lv_459" already exists in volume group "vg_459"
But then, because this is bash, we don't abort the test script and
continue executing. If we're lucky this fails when /dev/vg_459/lv_459
disappears before mkfs can run:
Error accessing specified device /dev/mapper/vg_459-lv_459: No such file or directory
Usage: mkfs.xfs
But in the bad case both nodes write filesystems to the same device and
then they trample all over each other. Fix this by adding the hostname
and pid to all the LVM names so that they won't collide.
Fixes: 461dad511f6b91 ("generic: Test filesystem lockup on full overprovisioned dm-thin")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/generic/459 | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tests/generic/459 b/tests/generic/459
index 98177f6b5ef8fb..32ee899f929819 100755
--- a/tests/generic/459
+++ b/tests/generic/459
@@ -47,10 +47,17 @@ _require_command "$THIN_CHECK_PROG" thin_check
_require_freeze
_require_odirect
-vgname=vg_$seq
-lvname=lv_$seq
-poolname=pool_$seq
-snapname=snap_$seq
+# Create all the LVM names with the hostname and pid so that we don't have any
+# collisions between VMs running from a shared pool of disks. Hyphens become
+# underscores because LVM turns those into double hyphens, which messes with
+# accessing /dev/mapper/$vg-$lv (which you're not supposed to do but this test
+# does anyway).
+lvmsuffix="${seq}_$(hostname -s | tr '-' '_')_$$"
+
+vgname=vg_$lvmsuffix
+lvname=lv_$lvmsuffix
+poolname=pool_$lvmsuffix
+snapname=snap_$lvmsuffix
origpsize=200
virtsize=300
newpsize=300
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH 17/16] generic/459: prevent collisions between test VMs backed by a shared disk pool
2024-11-26 20:27 ` [PATCH 17/16] generic/459: prevent collisions between test VMs backed by a shared disk pool Darrick J. Wong
@ 2024-11-27 5:43 ` Christoph Hellwig
2024-11-27 16:35 ` Darrick J. Wong
0 siblings, 1 reply; 26+ messages in thread
From: Christoph Hellwig @ 2024-11-27 5:43 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, zlang, fstests, linux-xfs
On Tue, Nov 26, 2024 at 12:27:29PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> If you happen to be running fstests on a bunch of VMs and the VMs all
> have access to a shared disk pool, then it's possible that two VMs could
> be running generic/459 at exactly the same time. In that case, it's a
> VERY bad thing to have two nodes trying to create an LVM volume group
> named "vg_459" because one node will succeed, after which the other node
> will see the vg_459 volume group that it didn't create:
>
> A volume group called vg_459 already exists.
> Logical volume pool_459 already exists in Volume group vg_459.
> Logical Volume "lv_459" already exists in volume group "vg_459"
>
> But then, because this is bash, we don't abort the test script and
> continue executing. If we're lucky this fails when /dev/vg_459/lv_459
> disappears before mkfs can run:
How the F.. do the VG names leak out of the VM scope?
That being said, the unique names looks fine to me, so:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 17/16] generic/459: prevent collisions between test VMs backed by a shared disk pool
2024-11-27 5:43 ` Christoph Hellwig
@ 2024-11-27 16:35 ` Darrick J. Wong
0 siblings, 0 replies; 26+ messages in thread
From: Darrick J. Wong @ 2024-11-27 16:35 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, zlang, fstests, linux-xfs
On Tue, Nov 26, 2024 at 09:43:42PM -0800, Christoph Hellwig wrote:
> On Tue, Nov 26, 2024 at 12:27:29PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > If you happen to be running fstests on a bunch of VMs and the VMs all
> > have access to a shared disk pool, then it's possible that two VMs could
> > be running generic/459 at exactly the same time. In that case, it's a
> > VERY bad thing to have two nodes trying to create an LVM volume group
> > named "vg_459" because one node will succeed, after which the other node
> > will see the vg_459 volume group that it didn't create:
> >
> > A volume group called vg_459 already exists.
> > Logical volume pool_459 already exists in Volume group vg_459.
> > Logical Volume "lv_459" already exists in volume group "vg_459"
> >
> > But then, because this is bash, we don't abort the test script and
> > continue executing. If we're lucky this fails when /dev/vg_459/lv_459
> > disappears before mkfs can run:
>
> How the F.. do the VG names leak out of the VM scope?
I ran fstests-xfs on my fstests-ocfs2 cluster, wherein all nodes have
write access to all disks because we're all one big happy fleet. Each
node gets a list of which disks it can use for fstests so in theory
there's no overlap ... until two machines tried to create LVM VGs with
the same name at exactly the same time and tripped. A sane prod system
would adjust the access controls per fstests run but I'm too lazy to do
that every night.
(Yeah, I just confessed to occasionally fstesting ocfs2.)
> That being said, the unique names looks fine to me, so:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Thanks!
--D
^ permalink raw reply [flat|nested] 26+ messages in thread