scratch rtdev handling improvements
Hi all,
this series improves handling of the scratch rtdev. It is a combination of Darrick's earlier patches for xfs/655 and xfs/656 and my earlier patch for a common helper so that they don't conflict.
PATCH 1/3 xfs/656: rearrange directio pread/pwrite for zoned filesystems
From: "Darrick J. Wong" <[email protected]>
On zoned filesystems, a write failure shuts down the filesystem, which makes this test fail with:
--- /run/fstests/bin/tests/xfs/656.out 2026-03-13 16:19:08.152939212 -0700
+++ /run/fstests/logs/xfs/656.out.bad 2026-06-30 18:16:43.847849604 -0700
@@ -1,10 +1,9 @@
QA output created by 656
Format and mount
pwrite: Input/output error
-pread: Input/output error
+stat: Input/output error
pread: Input/output error
fsync: Input/output error
VICTIM pos NUM len NUM: directio_write: Input/output error
-VICTIM pos NUM len NUM: directio_read: Input/output error
VICTIM pos NUM len NUM: buffered_read: Input/output error VICTIM pos NUM len NUM: buffered_write: Input/output error
Reorder the directio pread and pwrite to avoid this unnecessary failure. Note that we cycle the mount between the direct and buffered io tests, which is why we only need to fix the directio test.
--- tests/xfs/656 | 2 +- tests/xfs/656.out | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
tests/xfs/656 +1 -1
@@ -66,8 +66,8 @@ $XFS_IO_PROG -c 'healthmon -c -v' $SCRATCH_MNT >> $tmp.healthmon & healer_pid=$! sleep 1 # wait for program to start up _dmerror_load_error_table -$XFS_IO_PROG -d -c 'pwrite -b 256k 12k 16k' $testfile >> $seqres.full $XFS_IO_PROG -d -c 'pread -b 256k 10g 16k' $testfile >> $seqres.full +$XFS_IO_PROG -d -c 'pwrite -b 256k 12k 16k' $testfile >> $seqres.full _dmerror_load_working_table _dmerror_unmount
tests/xfs/656.out +2 -2
@@ -1,10 +1,10 @@ QA output created by 656 Format and mount -pwrite: Input/output error pread: Input/output error +pwrite: Input/output error pread: Input/output error fsync: Input/output error -VICTIM pos NUM len NUM: directio_write: Input/output error VICTIM pos NUM len NUM: directio_read: Input/output error +VICTIM pos NUM len NUM: directio_write: Input/output error VICTIM pos NUM len NUM: buffered_read: Input/output error VICTIM pos NUM len NUM: buffered_write: Input/output error
Signature · 1 line
2.53.0
Re: [PATCH 1/3] xfs/656: rearrange directio pread/pwrite for zoned filesystems
Quoted 20 lines · Christoph Hellwig
From: "Darrick J. Wong" <[email protected]>
On zoned filesystems, a write failure shuts down the filesystem, which makes this test fail with:
---
/run/fstests/bin/tests/xfs/656.out2026-03-13 16:19:08.152939212 -0700
+++/run/fstests/logs/xfs/656.out.bad2026-06-30 18:16:43.847849604 -0700
@@ -1,10 +1,9 @@
QA output created by 656
Format and mount
pwrite: Input/output error
-pread: Input/output error
+stat: Input/output error
pread: Input/output error
fsync: Input/output error
VICTIM pos NUM len NUM:directio_write: Input/output error
-VICTIM pos NUM len NUM:directio_read: Input/output error
VICTIM pos NUM len NUM:buffered_read: Input/output error VICTIM pos NUM len NUM:buffered_write: Input/output error
Quoted 7 lines
Reorder the directio pread and pwrite to avoid this unnecessary failure. Note that we cycle the mount between the direct and buffered io tests, which is why we only need to fix the directio test.
Signed-off-by "Darrick J. Wong" <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>---
Looks good to me,
Quoted 38 lines
tests/xfs/656 | 2 +- tests/xfs/656.out | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)tests/xfs/656 +1
-1@@ -66,8 +66,8 @@ $XFS_IO_PROG -c 'healthmon -c -v' $SCRATCH_MNT >> $tmp.healthmon & healer_pid=$! sleep 1 # wait for program to start up _dmerror_load_error_table -$XFS_IO_PROG -d -c 'pwrite -b 256k 12k 16k' $testfile >> $seqres.full $XFS_IO_PROG -d -c 'pread -b 256k 10g 16k' $testfile >> $seqres.full +$XFS_IO_PROG -d -c 'pwrite -b 256k 12k 16k' $testfile >> $seqres.full _dmerror_load_working_table _dmerror_unmounttests/xfs/656.out +2
-2@@ -1,10 +1,10 @@ QA output created by 656 Format and mount -pwrite: Input/output error pread: Input/output error +pwrite: Input/output error pread: Input/output error fsync: Input/output error -VICTIM pos NUM len NUM: directio_write: Input/output error VICTIM pos NUM len NUM: directio_read: Input/output error +VICTIM pos NUM len NUM: directio_write: Input/output error VICTIM pos NUM len NUM: buffered_read: Input/output error VICTIM pos NUM len NUM: buffered_write: Input/output errorSignature · 1 line
2.53.0
PATCH 2/3 xfs/65[56]: don't unset SCRATCH_RTDEV here
In reply to Christoph HellwigFrom: "Darrick J. Wong" <[email protected]>
Both of these tests claim that they have to unset SCRATCH_RTDEV to avoid formatting failures due to the rt bitmap consuming all the space in the "small" data device. However, the format doesn't constrain the size of the data device, so the justification doesn't apply. Remove the whole thing.
--- tests/xfs/655 | 4 ---- tests/xfs/656 | 4 ---- 2 files changed, 8 deletions(-)
tests/xfs/655 +0 -4
@@ -24,10 +24,6 @@ _require_scratch_nocheck _require_scratch_xfs_crc # can't detect minor corruption w/o crc _require_xfs_io_command healthmon -# Disable the scratch rt device to avoid test failures relating to the rt -# bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV - echo "Format and mount" _scratch_mkfs -d agcount=1 | _filter_mkfs 2> $tmp.mkfs >> $seqres.full . $tmp.mkfs
tests/xfs/656 +0 -4
@@ -40,10 +40,6 @@ filter_healer_errors() { uniq } -# Disable the scratch rt device to avoid test failures relating to the rt -# bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV - echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 _dmerror_init no_log
Signature · 1 line
2.53.0
Re: [PATCH 2/3] xfs/65[56]: don't unset SCRATCH_RTDEV here
Quoted 11 lines · Christoph Hellwig
From: "Darrick J. Wong" <[email protected]>
Both of these tests claim that they have to unset
SCRATCH_RTDEVto avoid formatting failures due to the rt bitmap consuming all the space in the "small" data device. However, the format doesn't constrain the size of the data device, so the justification doesn't apply. Remove the whole thing.Signed-off-by "Darrick J. Wong" <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>---
Quoted 37 lines
tests/xfs/655 | 4 ---- tests/xfs/656 | 4 ---- 2 files changed, 8 deletions(-)tests/xfs/655 +0
-4@@ -24,10 +24,6 @@ _require_scratch_nocheck _require_scratch_xfs_crc # can't detect minor corruption w/o crc _require_xfs_io_command healthmon -# Disable the scratch rt device to avoid test failures relating to the rt -# bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV - echo "Format and mount" _scratch_mkfs -d agcount=1 | _filter_mkfs 2> $tmp.mkfs >> $seqres.full . $tmp.mkfstests/xfs/656 +0
-4@@ -40,10 +40,6 @@ filter_healer_errors() { uniq } -# Disable the scratch rt device to avoid test failures relating to the rt -# bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV - echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 _dmerror_init no_logSignature · 1 line
2.53.0
PATCH 3/3 formalize and fix disabling the RT subvolume
In reply to Christoph HellwigVarious test unset SCRATCH_RTDEV to avoid dealing with metadata allocations for the RT subvolume in the main device or differences in RT subvolume behavior. Besides being rather ad-hoc, this unset also fails to disable the internal RT zoned subvolume.
Add a _disable_scratch_realtime helper that not only unsets SCRATCH_RTDEV, but also disables the zoned allocator and with that the internal RT subvolume.
--- common/filestreams | 2 +- common/rc | 9 +++++++++ tests/generic/250 | 2 +- tests/generic/252 | 2 +- tests/generic/441 | 2 +- tests/generic/484 | 2 +- tests/generic/487 | 2 +- tests/xfs/076 | 2 +- tests/xfs/189 | 2 +- tests/xfs/205 | 2 +- tests/xfs/306 | 2 +- tests/xfs/444 | 2 +- tests/xfs/445 | 2 +- 13 files changed, 21 insertions(+), 12 deletions(-)
common/filestreams +1 -1
@@ -84,7 +84,7 @@ _test_streams() { # Disable the scratch rt device to avoid test failures relating to the # rt bitmap consuming free space in our small data device and throwing # off the filestreams allocator. - unset SCRATCH_RTDEV + _disable_scratch_realtime # Skip these tests on zoned file systems as filestreams don't work # with the zoned allocator, and the operation below would force it into
common/rc +9 -0
@@ -2435,6 +2435,15 @@ _require_no_realtime() _notrun "Test not compatible with realtime subvolumes, skipped this test" } +# Disable usage of internal or external scratch devices +_disable_scratch_realtime() +{ + unset SCRATCH_RTDEV + if [ "$FSTYP" = "xfs" ]; then + MKFS_OPTIONS="${MKFS_OPTIONS//-r zoned=1}" + fi +} + # this test requires that a specified command (executable) exists # $1 - command, $2 - name for error message #
tests/generic/250 +1 -1
@@ -29,7 +29,7 @@ _require_odirect # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime fssize=$((196 * 1048576)) echo "Format and mount"
tests/generic/252 +1 -1
@@ -30,7 +30,7 @@ AIO_TEST="$here/src/aio-dio-regress/aiocp" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime fssize=$((196 * 1048576)) echo "Format and mount"
tests/generic/441 +1 -1
@@ -47,7 +47,7 @@ _require_test_program dmerror # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1
tests/generic/484 +1 -1
@@ -35,7 +35,7 @@ _require_xfs_io_command "syncfs" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1
tests/generic/487 +1 -1
@@ -40,7 +40,7 @@ _require_dm_target error # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1
tests/xfs/076 +1 -1
@@ -66,7 +66,7 @@ _require_xfs_sparse_inodes # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime _scratch_mkfs "-d size=96m -m crc=1 -i sparse" | tee -a $seqres.full | \ _filter_mkfs > /dev/null 2> $tmp.mkfs
tests/xfs/189 +1 -1
@@ -250,7 +250,7 @@ _require_no_realtime _require_scratch _require_noattr2 -unset SCRATCH_RTDEV +_disable_scratch_realtime unset SCRATCH_LOGDEV _scratch_mkfs_xfs | _filter_mkfs 2>/dev/null
tests/xfs/205 +1 -1
@@ -18,7 +18,7 @@ _require_scratch_nocheck # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime fsblksz=1024 _scratch_mkfs_xfs -d size=$((32768*fsblksz)) -b size=$fsblksz >> $seqres.full 2>&1
tests/xfs/306 +1 -1
@@ -26,7 +26,7 @@ _require_test_program "punch-alternating" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime # Create a small fs with a large directory block size. We want to fill up the fs # quickly and then create multi-fsb dirblocks over fragmented free space.
tests/xfs/444 +1 -1
@@ -31,7 +31,7 @@ _require_scratch_xfs_crc # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming free space in our small data device and throwing off the # filestreams allocator. -unset SCRATCH_RTDEV +_disable_scratch_realtime mount_loop() { if ! _try_scratch_mount >> $seqres.full 2>&1; then
tests/xfs/445 +1 -1
@@ -42,7 +42,7 @@ _check_filestreams_support || _notrun "filestreams not available" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming free space in our small data device and throwing off the # filestreams allocator. -unset SCRATCH_RTDEV +_disable_scratch_realtime # use small AGs for frequent stream switching _scratch_mkfs_xfs -d agsize=20m,size=2g >> $seqres.full 2>&1
Signature · 1 line
2.53.0
Re: [PATCH 3/3] formalize and fix disabling the RT subvolume
Quoted 10 lines · Christoph Hellwig
Various test unset
SCRATCH_RTDEVto avoid dealing with metadata allocations for the RT subvolume in the main device or differences in RT subvolume behavior. Besides being rather ad-hoc, this unset also fails to disable the internal RT zoned subvolume.Add a
_disable_scratch_realtimehelper that not only unsetsSCRATCH_RTDEV, but also disables the zoned allocator and with that the internal RT subvolume.Signed-off-by Christoph Hellwig <[email protected]>
Looks good to me now! :)
--D
Quoted 196 lines
--- common/filestreams | 2 +- common/rc | 9 +++++++++ tests/generic/250 | 2 +- tests/generic/252 | 2 +- tests/generic/441 | 2 +- tests/generic/484 | 2 +- tests/generic/487 | 2 +- tests/xfs/076 | 2 +- tests/xfs/189 | 2 +- tests/xfs/205 | 2 +- tests/xfs/306 | 2 +- tests/xfs/444 | 2 +- tests/xfs/445 | 2 +- 13 files changed, 21 insertions(+), 12 deletions(-)common/filestreams +1
-1@@ -84,7 +84,7 @@ _test_streams() { # Disable the scratch rt device to avoid test failures relating to the # rt bitmap consuming free space in our small data device and throwing # off the filestreams allocator. - unset SCRATCH_RTDEV + _disable_scratch_realtime # Skip these tests on zoned file systems as filestreams don't work # with the zoned allocator, and the operation below would force it intocommon/rc +9
-0@@ -2435,6 +2435,15 @@ _require_no_realtime() _notrun "Test not compatible with realtime subvolumes, skipped this test" } +# Disable usage of internal or external scratch devices +_disable_scratch_realtime() +{ + unset SCRATCH_RTDEV + if [ "$FSTYP" = "xfs" ]; then + MKFS_OPTIONS="${MKFS_OPTIONS//-r zoned=1}" + fi +} + # this test requires that a specified command (executable) exists # $1 - command, $2 - name for error message #tests/generic/250 +1
-1@@ -29,7 +29,7 @@ _require_odirect # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime fssize=$((196 * 1048576)) echo "Format and mount"tests/generic/252 +1
-1@@ -30,7 +30,7 @@ AIO_TEST="$here/src/aio-dio-regress/aiocp" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime fssize=$((196 * 1048576)) echo "Format and mount"tests/generic/441 +1
-1@@ -47,7 +47,7 @@ _require_test_program dmerror # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1tests/generic/484 +1
-1@@ -35,7 +35,7 @@ _require_xfs_io_command "syncfs" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1tests/generic/487 +1
-1@@ -40,7 +40,7 @@ _require_dm_target error # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1tests/xfs/076 +1
-1@@ -66,7 +66,7 @@ _require_xfs_sparse_inodes # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime _scratch_mkfs "-d size=96m -m crc=1 -i sparse" | tee -a $seqres.full | \ _filter_mkfs > /dev/null 2> $tmp.mkfstests/xfs/189 +1
-1@@ -250,7 +250,7 @@ _require_no_realtime _require_scratch _require_noattr2 -unset SCRATCH_RTDEV +_disable_scratch_realtime unset SCRATCH_LOGDEV _scratch_mkfs_xfs | _filter_mkfs 2>/dev/nulltests/xfs/205 +1
-1@@ -18,7 +18,7 @@ _require_scratch_nocheck # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime fsblksz=1024 _scratch_mkfs_xfs -d size=$((32768*fsblksz)) -b size=$fsblksz >> $seqres.full 2>&1tests/xfs/306 +1
-1@@ -26,7 +26,7 @@ _require_test_program "punch-alternating" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming all the free space in our small data device. -unset SCRATCH_RTDEV +_disable_scratch_realtime # Create a small fs with a large directory block size. We want to fill up the fs # quickly and then create multi-fsb dirblocks over fragmented free space.tests/xfs/444 +1
-1@@ -31,7 +31,7 @@ _require_scratch_xfs_crc # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming free space in our small data device and throwing off the # filestreams allocator. -unset SCRATCH_RTDEV +_disable_scratch_realtime mount_loop() { if ! _try_scratch_mount >> $seqres.full 2>&1; thentests/xfs/445 +1
-1@@ -42,7 +42,7 @@ _check_filestreams_support || _notrun "filestreams not available" # Disable the scratch rt device to avoid test failures relating to the rt # bitmap consuming free space in our small data device and throwing off the # filestreams allocator. -unset SCRATCH_RTDEV +_disable_scratch_realtime # use small AGs for frequent stream switching _scratch_mkfs_xfs -d agsize=20m,size=2g >> $seqres.full 2>&1Signature · 1 line
2.53.0