* xfstests support for RT data checksums
@ 2026-09-24 10:07 Christoph Hellwig
2026-09-24 10:07 ` [PATCH 01/13] add a "datacsum" group Christoph Hellwig
` (12 more replies)
0 siblings, 13 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Hi all,
this series adds support for testing the new XFS RT data checksum
feature.
Most of it should be fairly straight forward, but I'd like to hear about
the new xfs/2304 and xfs/2305 tests. These are basically copy and pasted
from existing very long running tests, but add calls to xfs_scrub -x.
It might make sense to just add this to the existing tests conditionally
on the new XFS_VERIFY_FILE_DATA flag, but I'd like to hear various
opinions on that.
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH 01/13] add a "datacsum" group
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:31 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable Christoph Hellwig
` (11 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Add a group for test exercising data checksum functionality.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
doc/group-names.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/doc/group-names.txt b/doc/group-names.txt
index ef6b8f51cf87..101c72688c02 100644
--- a/doc/group-names.txt
+++ b/doc/group-names.txt
@@ -34,6 +34,7 @@ dangerous dangerous test that can crash the system
dangerous_fuzzers fuzzers that can crash your computer
dangerous_selftest selftests that crash/hang
data data loss checkers
+datacsum data checksumming
dax direct access mode for persistent memory files
db xfs_db functional tests
dedupe FIEDEDUPERANGE ioctl
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
2026-09-24 10:07 ` [PATCH 01/13] add a "datacsum" group Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:32 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable Christoph Hellwig
` (10 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Add a new SCRATCH_MKFS_OPTIONS variable, which contains options that are
only applied to the actualy scratch device, but not to various other
devices like scsi_debug or loop devices created by various test.
This is important to support mkfs options that do not work on arbitrary
devices, like the extended LBA based data checksum support.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
README | 2 ++
common/rc | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/README b/README
index 8644f163b1ab..cc03f51e1ad3 100644
--- a/README
+++ b/README
@@ -303,6 +303,8 @@ Extra SCRATCH device specifications:
- Set SCRATCH_LOGDEV to "device for scratch-fs external log"
- Set SCRATCH_RTDEV to "device for scratch-fs realtime data"
- If SCRATCH_LOGDEV and/or SCRATCH_RTDEV, the USE_EXTERNAL environment
+ - Set SCRARCH_MKFS_OPTIONS if you want to specify additional mkfs options
+ to be used when creating file system on SCRATCH_DEV.
Tape device specification for xfsdump testing:
- Set TAPE_DEV to "tape device for testing xfsdump".
diff --git a/common/rc b/common/rc
index 3958ac934980..7fc5ff956959 100644
--- a/common/rc
+++ b/common/rc
@@ -805,12 +805,14 @@ _scratch_do_mkfs()
local mkfs_filter=$2
shift 2
local extra_mkfs_options=$*
+ local mkfs_options
local mkfs_status
local tmp=`mktemp -u`
# save mkfs output in case conflict means we need to run again.
# only the output for the mkfs that applies should be shown
- eval "$mkfs_cmd $MKFS_OPTIONS $extra_mkfs_options $SCRATCH_DEV" \
+ mkfs_options="$MKFS_OPTIONS $SCRATCH_MKFS_OPTIONS $extra_mkfs_options"
+ eval "$mkfs_cmd $mkfs_options $SCRATCH_DEV" \
2>$tmp.mkfserr 1>$tmp.mkfsstd
mkfs_status=$?
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
2026-09-24 10:07 ` [PATCH 01/13] add a "datacsum" group Christoph Hellwig
2026-09-24 10:07 ` [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:34 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 04/13] xfs/206: filter out csum information from mkfs output Christoph Hellwig
` (9 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Add an option to run the end of testt xfs_scrub call using the -x
option to also check file data validity.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
README | 3 +++
common/xfs | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/README b/README
index cc03f51e1ad3..0ce7d4463354 100644
--- a/README
+++ b/README
@@ -326,6 +326,9 @@ Extra XFS specification:
- xfs_scrub, if present, will always check the test and scratch
filesystems if they are still online at the end of the test. It is no
longer necessary to set TEST_XFS_SCRUB.
+ - Set XFS_VERIFY_FILE_DATA option to also check file data integrity using the
+ -x option to xfs_scrub. This makes the xfs_scrub based checks a lot slower,
+ but verifies the data checksum support in XFS.
Tools specification:
- dump:
diff --git a/common/xfs b/common/xfs
index 98981e624dda..8254e48603af 100644
--- a/common/xfs
+++ b/common/xfs
@@ -875,6 +875,12 @@ _check_xfs_filesystem()
# Run online scrub if we can.
mntpt="$(_is_dev_mounted $device)"
if [ -n "$mntpt" ] && _supports_xfs_scrub "$mntpt" "$device"; then
+ local xfs_scrub_opts="-v -d -n"
+
+ if [ -n "$XFS_VERIFY_FILE_DATA" ]; then
+ xfs_scrub_opts="$xfs_scrub_opts -x"
+ fi
+
can_scrub=1
# Tests can create a scenario in which a call to syncfs() issued
@@ -888,7 +894,7 @@ _check_xfs_filesystem()
# before executing a scrub operation.
$XFS_IO_PROG -c syncfs $mntpt >> $seqres.full 2>&1
- "$XFS_SCRUB_PROG" -v -d -n $mntpt > $tmp.scrub 2>&1
+ "$XFS_SCRUB_PROG" $xfs_scrub_opts $mntpt > $tmp.scrub 2>&1
if [ $? -ne 0 ]; then
_log_err "_check_xfs_filesystem: filesystem on $device failed scrub"
echo "*** xfs_scrub -v -d -n output ***" >> $seqres.full
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 04/13] xfs/206: filter out csum information from mkfs output
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (2 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:34 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 05/13] xfs: add a _require_xfs_data_csum helper Christoph Hellwig
` (8 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
To make the test work with csum-enabled mkfs.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/206 | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/xfs/206 b/tests/xfs/206
index a515c6c8838c..f5e0b1404732 100755
--- a/tests/xfs/206
+++ b/tests/xfs/206
@@ -67,6 +67,7 @@ mkfs_filter()
-e 's/, parent=[01]//' \
-e '/rgcount=/d' \
-e '/zoned=/d' \
+ -e '/csum=/d' \
-e "/^Default configuration/d"
}
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 05/13] xfs: add a _require_xfs_data_csum helper
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (3 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 04/13] xfs/206: filter out csum information from mkfs output Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:38 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 06/13] xfs/2301: test lazy bounce buffering mode Christoph Hellwig
` (7 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Add a helper to check if a given mountpoint supports (RT) data checksums
on XFS.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
common/xfs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/common/xfs b/common/xfs
index 8254e48603af..e9f6877c98cd 100644
--- a/common/xfs
+++ b/common/xfs
@@ -2448,3 +2448,16 @@ _require_xfs_healer()
_scratch_mkfs_xfs_supported "$arg" concurrency=0
}
+
+# require (RT) data checksum support on the passed mountpoint
+_require_xfs_data_csum()
+{
+ mnt=$1
+
+ csumval=$($XFS_IO_PROG -c 'statfs -g' $mnt | \
+ grep "geom.rtcsum_type" | awk '{print $3}')
+ echo "csumval: $csumval" >> $seqres.full
+ if [ -e "$csumval" -o "$csumval" -eq "0" ]; then
+ _notrun "requires XFS data checsums"
+ fi
+}
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 06/13] xfs/2301: test lazy bounce buffering mode
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (4 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 05/13] xfs: add a _require_xfs_data_csum helper Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:42 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 07/13] xfs/2302: add a basic data checksum test Christoph Hellwig
` (6 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Run fsx (based on generic/091) while injecting lazy bounce buffer
retries for reads.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2301 | 43 +++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2301.out | 13 +++++++++++++
2 files changed, 56 insertions(+)
create mode 100755 tests/xfs/2301
create mode 100644 tests/xfs/2301.out
diff --git a/tests/xfs/2301 b/tests/xfs/2301
new file mode 100755
index 000000000000..605510c6dbc8
--- /dev/null
+++ b/tests/xfs/2301
@@ -0,0 +1,43 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+# Copyright (c) 2026 Christoph Hellwig.
+#
+# FS QA Test No. 2301
+#
+# Run fsx with error injection for re-retries with bounce buffers, simulating
+# users modifying the in-flight data buffer.
+#
+. ./common/preamble
+_begin_fstest rw auto quick datacsum
+
+. ./common/filter
+. ./common/inject
+
+_require_test
+_require_odirect
+_require_xfs_data_csum $TEST_DIR
+
+psize=`$here/src/feature -s`
+bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
+
+_test_inject_error bounce_reread 100
+
+# fsx load similar to generic/091
+echo "Testing direct I/O"
+run_fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+run_fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+run_fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+run_fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+run_fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+run_fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
+
+# fsx load similar to generic/091 but using buffered I/O
+echo "Testing buffered I/O"
+run_fsx -N 10000 -l 500000
+run_fsx -N 10000 -o 8192 -l 500000
+run_fsx -N 10000 -o 32768 -l 500000
+run_fsx -N 10000 -o 128000 -l 500000
+
+status=0
+exit
diff --git a/tests/xfs/2301.out b/tests/xfs/2301.out
new file mode 100644
index 000000000000..221a3185970c
--- /dev/null
+++ b/tests/xfs/2301.out
@@ -0,0 +1,13 @@
+QA output created by 2301
+Testing direct I/O
+fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
+fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
+Testing buffered I/O
+fsx -N 10000 -l 500000
+fsx -N 10000 -o 8192 -l 500000
+fsx -N 10000 -o 32768 -l 500000
+fsx -N 10000 -o 128000 -l 500000
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 07/13] xfs/2302: add a basic data checksum test
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (5 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 06/13] xfs/2301: test lazy bounce buffering mode Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:48 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement Christoph Hellwig
` (5 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Setup a zoned loop device, mess up the data and make sure both buffered
and direct I/O catch it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2302 | 96 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2302.out | 25 ++++++++++++
2 files changed, 121 insertions(+)
create mode 100755 tests/xfs/2302
create mode 100644 tests/xfs/2302.out
diff --git a/tests/xfs/2302 b/tests/xfs/2302
new file mode 100755
index 000000000000..d0ef9abc87b0
--- /dev/null
+++ b/tests/xfs/2302
@@ -0,0 +1,96 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Christoph Hellwig
+#
+# FS QA Test No. 2302
+#
+# Test that data checksums detect data corruption using all three bounce
+# buffering modes.
+#
+. ./common/preamble
+. ./common/filter
+. ./common/zoned
+
+_begin_fstest auto zone quick datacsum
+
+cleanup_devices()
+{
+ [ -n "$mnt" ] && _unmount $mnt 2>/dev/null
+ [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
+ _destroy_zloop $zloop_dev
+ cd /
+ rm -rf $loopfile $zloopdir $mnt
+}
+
+_cleanup()
+{
+ cleanup_devices
+}
+
+_require_test
+_require_loop
+_require_zloop
+# hack to only run for block based file systems
+_require_block_device $SCRATCH_DEV
+
+loopfile="$TEST_DIR/loopfile"
+zloopdir="$TEST_DIR/zloop"
+mnt="$TEST_DIR/mnt"
+
+test_error_detection()
+{
+ local bounce_mode=$1
+
+ echo
+ echo
+ echo "Testing bounce mode: $bounce_mode"
+ echo
+
+ rm -rf $loopfile $zloopdir $mnt
+ mkdir -p $mnt
+ truncate -s 1g $loopfile
+
+ local loop_dev=$(_create_loop_device $loopfile)
+ local zloop_dev=$(_create_zloop $zloopdir 256 0)
+ local zloop_id=$(echo $zloop_dev | grep -oE '[0-9]+$')
+
+ _try_mkfs_dev $loop_dev -r rtdev=$zloop_dev,csum=crc32c \
+ >> $seqres.full 2>&1 || \
+ _notrun "cannot mkfs filesystem with data checksums"
+ _mount $loop_dev -o rtdev=$zloop_dev $mnt
+
+ dd if=/dev/urandom of=$mnt/file bs=1M count=200 conv=fsync >/dev/null 2>&1
+
+ local rg=`xfs_bmap -v $mnt/file | head -n 3 | _filter_bmap_gno`
+ local zloop_filename=$(printf "seq-%06u\n" $rg)
+ local backing_file="$zloopdir/$zloop_id/$zloop_filename"
+
+ _unmount $mnt 2>/dev/null
+
+ # intentionally corrupt the data on the backing device
+ xfs_io $backing_file -d -c 'pwrite 0 16384' >> $seqres.full 2>&1
+
+ # should return an error on buffered read
+ _mount $loop_dev -o rtdev=$zloop_dev $mnt
+ _set_fs_sysfs_attr $loop_dev csum/read_bounce $bounce_mode
+ echo "Reading file using cat - should fail"
+ cat $mnt/file > /dev/null | _filter_test_dir
+
+ sleep 1
+ _unmount $mnt 2>/dev/null
+
+ # same with direct I/O
+ _mount $loop_dev -o rtdev=$zloop_dev $mnt
+ _set_fs_sysfs_attr $loop_dev csum/read_bounce $bounce_mode
+ echo "Reading file using O_DIRECT - should fail"
+ xfs_io -d $mnt/file -c 'pread 0 200M' | _filter_test_dir
+
+ sleep 1
+ cleanup_devices
+}
+
+test_error_detection "never"
+test_error_detection "always"
+test_error_detection "lazy"
+
+_exit 0
diff --git a/tests/xfs/2302.out b/tests/xfs/2302.out
new file mode 100644
index 000000000000..5e2108b5cec0
--- /dev/null
+++ b/tests/xfs/2302.out
@@ -0,0 +1,25 @@
+QA output created by 2302
+
+
+Testing bounce mode: never
+
+Reading file using cat - should fail
+cat: /mnt/test/mnt/file: Input/output error
+Reading file using O_DIRECT - should fail
+pread: Input/output error
+
+
+Testing bounce mode: always
+
+Reading file using cat - should fail
+cat: /mnt/test/mnt/file: Input/output error
+Reading file using O_DIRECT - should fail
+pread: Input/output error
+
+
+Testing bounce mode: lazy
+
+Reading file using cat - should fail
+cat: /mnt/test/mnt/file: Input/output error
+Reading file using O_DIRECT - should fail
+pread: Input/output error
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (6 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 07/13] xfs/2302: add a basic data checksum test Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:54 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration Christoph Hellwig
` (4 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Test that data checksums detect data corruption due to misplacement
by changing the backing files for two zones using the zloop driver.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2303 | 88 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2303.out | 5 +++
2 files changed, 93 insertions(+)
create mode 100755 tests/xfs/2303
create mode 100644 tests/xfs/2303.out
diff --git a/tests/xfs/2303 b/tests/xfs/2303
new file mode 100755
index 000000000000..7f53fdf94bff
--- /dev/null
+++ b/tests/xfs/2303
@@ -0,0 +1,88 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Christoph Hellwig
+#
+# FS QA Test No. 2303
+#
+# Test that data checksums detect data corruption due to misplacement
+# by changing the backing files for two zones using the zloop driver.
+#
+. ./common/preamble
+. ./common/filter
+. ./common/renameat2
+. ./common/zoned
+
+_begin_fstest auto zone quick datacsum
+
+_cleanup()
+{
+ [ -n "$mnt" ] && _unmount $mnt 2>/dev/null
+ [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
+ _destroy_zloop $zloop_dev
+ cd /
+ rm -rf $loopfile $zloopdir $mnt
+}
+
+_require_test
+_require_renameat2 "exchange"
+_require_loop
+_require_zloop
+# hack to only run for block based file systems
+_require_block_device $SCRATCH_DEV
+
+loopfile="$TEST_DIR/loopfile"
+zloopdir="$TEST_DIR/zloop"
+mnt="$TEST_DIR/mnt"
+
+rm -rf $loopfile $zloopdir $mnt
+mkdir -p $mnt
+truncate -s 1g $loopfile
+
+loop_dev=$(_create_loop_device $loopfile)
+zloop_dev=$(_create_zloop $zloopdir 256 0)
+zloop_id=$(echo $zloop_dev | grep -oE '[0-9]+$')
+
+_try_mkfs_dev $loop_dev -r rtdev=$zloop_dev,csum=crc32c \
+ >> $seqres.full 2>&1 || \
+ _notrun "cannot mkfs filesystem with data checksums"
+_mount $loop_dev -o rtdev=$zloop_dev $mnt
+
+dd if=/dev/urandom of=$mnt/file1 bs=4k count=1 conv=fsync >/dev/null 2>&1
+dd if=/dev/zero of=$mnt/file2 bs=4k count=1 conv=fsync >/dev/null 2>&1
+
+xfs_bmap -v $mnt/file1 >> $seqres.full 2>&1
+xfs_bmap -v $mnt/file2 >> $seqres.full 2>&1
+
+rg1=`xfs_bmap -v $mnt/file1 | head -n 3 | _filter_bmap_gno`
+rg2=`xfs_bmap -v $mnt/file2 | head -n 3 | _filter_bmap_gno`
+if [ "$rg1" == "$rg2" ]; then
+ _fail "both files placed in same RG: $rg1 $rg2"
+fi
+
+zloop_filename1=$(printf "seq-%06u\n" $rg1)
+backing_file1="$zloopdir/$zloop_id/$zloop_filename1"
+zloop_filename2=$(printf "seq-%06u\n" $rg2)
+backing_file2="$zloopdir/$zloop_id/$zloop_filename2"
+
+_unmount $mnt 2>/dev/null
+_destroy_zloop $zloop_dev
+
+# intentionally corrupt data by swapping the two zone files
+ls -i $backing_file1 $backing_file2 >> $seqres.full
+echo "swapping file $backing_file1 and $backing_file2" >> $seqres.full
+$here/src/renameat2 -x $backing_file1 $backing_file2
+ls -i $backing_file1 $backing_file2 >> $seqres.full
+
+zloop_dev=$(_create_zloop $zloopdir 256 0)
+zloop_id=$(echo $zloop_dev | grep -oE '[0-9]+$')
+_mount $loop_dev -o rtdev=$zloop_dev $mnt
+
+# should return an error on buffered read
+echo "Reading file1 using cat - should fail"
+cat $mnt/file1 > /dev/null | _filter_test_dir
+
+# same with direct I/O
+echo "Reading file2 using O_DIRECT - should fail"
+xfs_io -d $mnt/file2 -c 'pread 0 200M' | _filter_test_dir
+
+_exit 0
diff --git a/tests/xfs/2303.out b/tests/xfs/2303.out
new file mode 100644
index 000000000000..fca2c4830e3c
--- /dev/null
+++ b/tests/xfs/2303.out
@@ -0,0 +1,5 @@
+QA output created by 2303
+Reading file1 using cat - should fail
+cat: /mnt/test/mnt/file1: Input/output error
+Reading file2 using O_DIRECT - should fail
+pread: Input/output error
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (7 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:56 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 10/13] xfs/2305: version of generic/475 " Christoph Hellwig
` (3 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
To check both the metadata integrity and file system checksums after
log replay.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2304 | 61 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2304.out | 2 ++
2 files changed, 63 insertions(+)
create mode 100755 tests/xfs/2304
create mode 100644 tests/xfs/2304.out
diff --git a/tests/xfs/2304 b/tests/xfs/2304
new file mode 100755
index 000000000000..ad4f45d79057
--- /dev/null
+++ b/tests/xfs/2304
@@ -0,0 +1,61 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
+#
+# FS QA Test No. 2304
+#
+# Copied from generic/388, with added xfs_scrub -x calls for each iteration to
+# verify the integrity of all file data and metadata.
+#
+# Test XFS log recovery ordering on v5 superblock filesystems. XFS had a problem
+# where it would incorrectly replay older modifications from the log over more
+# recent versions of metadata due to failure to update metadata LSNs during log
+# recovery. This could result in false positive reports of corruption during log
+# recovery and permanent mount failure.
+#
+# To test this situation, run frequent shutdowns immediately after log recovery.
+# Ensure that log recovery does not recover stale modifications and cause
+# spurious corruption reports and/or mount failures.
+#
+. ./common/preamble
+_begin_fstest shutdown auto log metadata recoveryloop datacsum
+
+_require_scratch
+_require_local_device $SCRATCH_DEV
+_require_scratch_shutdown
+
+echo "Silence is golden."
+
+_scratch_mkfs >> $seqres.full 2>&1
+_require_metadata_journaling $SCRATCH_DEV
+_scratch_mount
+_require_scratch_xfs_scrub
+
+while _soak_loop_running $((50 * TIME_FACTOR)); do
+ _run_fsstress_bg -d $SCRATCH_MNT -n 999999 -p 4
+
+ # purposely include 0 second sleeps to test shutdown immediately after
+ # recovery
+ sleep $((RANDOM % 3))
+ _scratch_shutdown
+
+ _kill_fsstress
+
+ # Toggle between rw and ro mounts for recovery. Quit if any mount
+ # attempt fails so we don't shutdown the host fs.
+ if [ $((RANDOM % 2)) -eq 0 ]; then
+ _scratch_cycle_mount || _fail "cycle mount failed"
+ else
+ _scratch_cycle_mount "ro" || _fail "cycle ro mount failed"
+ _scratch_cycle_mount || _fail "cycle rw mount failed"
+ fi
+
+ $XFS_SCRUB_PROG -x $SCRATCH_MNT >> $seqres.full 2>&1
+ if [ $? -ne 0 ]; then
+ _fail "scrub found errors"
+ fi
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/2304.out b/tests/xfs/2304.out
new file mode 100644
index 000000000000..07ee489db9fa
--- /dev/null
+++ b/tests/xfs/2304.out
@@ -0,0 +1,2 @@
+QA output created by 2304
+Silence is golden.
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 10/13] xfs/2305: version of generic/475 that run xfs_scrub -x for each iteration
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (8 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:57 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options Christoph Hellwig
` (2 subsequent siblings)
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
To check both the metadata integrity and file system checksums after
log replay.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2305 | 75 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2305.out | 2 ++
2 files changed, 77 insertions(+)
create mode 100755 tests/xfs/2305
create mode 100644 tests/xfs/2305.out
diff --git a/tests/xfs/2305 b/tests/xfs/2305
new file mode 100755
index 000000000000..277f81c13887
--- /dev/null
+++ b/tests/xfs/2305
@@ -0,0 +1,75 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
+#
+# FS QA Test No. 2305
+#
+# Copied from generic/475, with added xfs_scrub -x calls for each iteration to
+# verify the integrity of all file data and metadata.
+#
+# Test log recovery with repeated (simulated) disk failures. We kick
+# off fsstress on the scratch fs, then switch out the underlying device
+# with dm-error to see what happens when the disk goes down. Having
+# taken down the fs in this manner, remount it and repeat. This test
+# is a Good Enough (tm) simulation of our internal multipath failure
+# testing efforts.
+#
+. ./common/preamble
+_begin_fstest shutdown auto log metadata eio recoveryloop smoketest datacsum
+
+# Override the default cleanup function.
+_cleanup()
+{
+ _kill_fsstress
+ _dmerror_unmount
+ _dmerror_cleanup
+ cd /
+ rm -f $tmp.*
+}
+
+# Import common functions.
+. ./common/dmerror
+
+# Modify as appropriate.
+
+_require_scratch
+_require_dm_target error
+
+echo "Silence is golden."
+
+_scratch_mkfs >> $seqres.full 2>&1
+_require_metadata_journaling $SCRATCH_DEV
+_dmerror_init
+_dmerror_mount
+
+while _soak_loop_running $((50 * TIME_FACTOR)); do
+ _run_fsstress_bg -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4))
+
+ # purposely include 0 second sleeps to test shutdown immediately after
+ # recovery
+ sleep $((RANDOM % 3))
+
+ # This test aims to simulate sudden disk failure, which means that we
+ # do not want to quiesce the filesystem or otherwise give it a chance
+ # to flush its logs. Therefore we want to call dmsetup with the
+ # --nolockfs parameter; to make this happen we must call the load
+ # error table helper *without* 'lockfs'.
+ _dmerror_load_error_table
+
+ _kill_fsstress
+
+ # Mount again to replay log after loading working table, so we have a
+ # consistent XFS after test.
+ _dmerror_unmount || _fail "unmount failed"
+ _dmerror_load_working_table
+ _dmerror_mount || _fail "mount failed"
+
+ $XFS_SCRUB_PROG -x $SCRATCH_MNT >> $seqres.full 2>&1
+ if [ $? -ne 0 ]; then
+ _fail "scrub found errors"
+ fi
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/2305.out b/tests/xfs/2305.out
new file mode 100644
index 000000000000..8265227294ca
--- /dev/null
+++ b/tests/xfs/2305.out
@@ -0,0 +1,2 @@
+QA output created by 2305
+Silence is golden.
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (9 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 10/13] xfs/2305: version of generic/475 " Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 1:59 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums Christoph Hellwig
2026-09-24 10:07 ` [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair Christoph Hellwig
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2306 | 50 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2306.out | 20 +++++++++++++++++++
2 files changed, 70 insertions(+)
create mode 100755 tests/xfs/2306
create mode 100644 tests/xfs/2306.out
diff --git a/tests/xfs/2306 b/tests/xfs/2306
new file mode 100755
index 000000000000..76dac5bb2a69
--- /dev/null
+++ b/tests/xfs/2306
@@ -0,0 +1,50 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2026 Christoph Hellwig.
+#
+# FS QA Test No. 2306
+#
+# Test mkfs input checking for the csum and csumbsize options.
+#
+. ./common/preamble
+_begin_fstest auto quick mkfs zone datacsum
+
+. ./common/filter
+
+_require_scratch_nocheck
+
+expect_fail()
+{
+ opts=$1
+ msg=$2
+
+ echo "Testing $msg (expect failure)"
+ $MKFS_XFS_PROG -f $opts $SCRATCH_DEV 2>&1 | head -n1
+}
+
+expect_fail "-r csum=crc32c" "csum option without zoned"
+expect_fail "-r csumbsize=32k" "csumbsize option without zoned"
+expect_fail "-r zoned,csum=crc16" "invalid csum value"
+expect_fail "-r zoned,csum=crc32c,csumbsize=1k" "too small csumbsize"
+expect_fail "-r zoned,csum=crc32c,csumbsize=48k" "non-pow2 csumbsize"
+expect_fail "-r zoned,csum=crc32c,csumbsize=128k" "too large csumbsize"
+expect_fail "-b size=64k -r zoned,csum=crc32c,csumbsize=32k" "csumbsize < bsize"
+
+expect_pass()
+{
+ opts=$1
+ msg=$2
+
+ echo "Testing $msg (expect pass)"
+ $MKFS_XFS_PROG -f $opts $SCRATCH_DEV >> $seqres.full 2>&1 || \
+ _fail "could not mkfs for $opts"
+}
+
+expect_pass "-r zoned,csum=none" "csum=none"
+expect_pass "-r zoned,csum=crc32c" "csum=crc32c"
+expect_pass "-r zoned,csum=crc64" "csum=crc64"
+expect_pass "-r zoned,csum=crc64,csumbsize=32k" "csum=crc64,csumbsize=32k"
+expect_pass "-r zoned,csum=crc64,csumbsize=64k" "csum=crc64,csumbsize=64k"
+
+status=0
+exit
diff --git a/tests/xfs/2306.out b/tests/xfs/2306.out
new file mode 100644
index 000000000000..5e79103212ad
--- /dev/null
+++ b/tests/xfs/2306.out
@@ -0,0 +1,20 @@
+QA output created by 2306
+Testing csum option without zoned (expect failure)
+data checksums not supported without zoned mode
+Testing csumbsize option without zoned (expect failure)
+RT data csum block size options requires RT data csum type.
+Testing invalid csum value (expect failure)
+unknown option -r crc16
+Testing too small csumbsize (expect failure)
+Invalid value 1k for -r csumbsize option. Value is too small.
+Testing non-pow2 csumbsize (expect failure)
+RT data csum block size of 49152 bytes is not a power of 2
+Testing too large csumbsize (expect failure)
+Invalid value 128k for -r csumbsize option. Value is too large.
+Testing csumbsize < bsize (expect failure)
+RT data csum block size of 32768 bytes is smaller than fsblock size 65536.
+Testing csum=none (expect pass)
+Testing csum=crc32c (expect pass)
+Testing csum=crc64 (expect pass)
+Testing csum=crc64,csumbsize=32k (expect pass)
+Testing csum=crc64,csumbsize=64k (expect pass)
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (10 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 2:05 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair Christoph Hellwig
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Inject errors into the rtcsum files and check that the kernel handles
them gracefully and that repair fixes them, rebuilding the checksums if
needed.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2307 | 106 +++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2307.out | 93 +++++++++++++++++++++++++++++++++++++++
2 files changed, 199 insertions(+)
create mode 100755 tests/xfs/2307
create mode 100644 tests/xfs/2307.out
diff --git a/tests/xfs/2307 b/tests/xfs/2307
new file mode 100755
index 000000000000..47d5be36623d
--- /dev/null
+++ b/tests/xfs/2307
@@ -0,0 +1,106 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2026 Christoph Hellwig.
+#
+# FS QA Test No. 2307
+#
+# Inject errors into the rtcsum files and check that the kernel handles
+# them gracefully and that repair fixes them, rebuilding the checksums if
+# needed.
+#
+. ./common/preamble
+_begin_fstest auto quick repair zone datacsum
+
+. ./common/filter
+. ./common/repair
+
+_require_scratch_nocheck
+
+
+prepare_fs()
+{
+ _scratch_mkfs >> $seqres.full 2>&1
+ _scratch_mount
+ _require_xfs_data_csum $TEST_DIR
+ cat /bin/sh > $SCRATCH_MNT/sh
+ _scratch_unmount
+}
+
+exercise_repair()
+{
+ echo "Checking corrupted file system"
+ _scratch_xfs_repair -P -n >> $seqres.full 2>&1
+
+ echo "Repairing corrupted file system"
+ _scratch_xfs_repair -P >> $seqres.full 2>&1
+}
+
+check_corrupted()
+{
+ echo "Checking corrupted file system"
+ _scratch_xfs_repair -P -n >> $seqres.full 2>&1
+ if [ $? -eq 0 ]; then
+ _fail "xfs_repair -n succeeded"
+ fi
+
+ _scratch_mount
+
+ echo "Reading from corrupted file system"
+ cmp /bin/sh $SCRATCH_MNT/sh
+ _scratch_unmount
+}
+
+check_fixed()
+{
+ echo "Checking repaired file system"
+ _scratch_xfs_repair -P -n 2>&1 | _filter_repair
+
+ _scratch_mount
+
+ echo "Scrubbing repaired file system"
+ $XFS_SCRUB_PROG -x -a 0 $SCRATCH_MNT >> $seqres.full
+ if [ $? -ne 0 ]; then
+ _fail "xfs_scrub failed"
+ fi
+
+ echo "Reading from repaired file system"
+ cmp /bin/sh $SCRATCH_MNT/sh
+ _scratch_unmount
+}
+
+echo
+echo
+echo "Corrupting rtcsum inode size"
+echo
+prepare_fs
+_scratch_xfs_set_metadata_field core.size 18 "path -m /rtgroups/0.csum"
+check_corrupted
+exercise_repair
+check_fixed
+
+echo
+echo
+echo "Corrupting rtcsum inode mode"
+echo
+prepare_fs
+_scratch_xfs_set_metadata_field core.mode 0 "path -m /rtgroups/0.csum"
+if _try_scratch_mount >>$seqres.full 2>&1; then
+ _fail "mount succeeded with corrupted nextents"
+fi
+exercise_repair
+check_fixed
+
+echo
+echo
+echo "Corrupting rtcsum inode nextents"
+echo
+prepare_fs
+_scratch_xfs_set_metadata_field core.nextents 2 "path -m /rtgroups/0.csum"
+if _try_scratch_mount >>$seqres.full 2>&1; then
+ _fail "mount succeeded with corrupted nextents"
+fi
+exercise_repair
+check_fixed
+
+status=0
+exit
diff --git a/tests/xfs/2307.out b/tests/xfs/2307.out
new file mode 100644
index 000000000000..2016c27ee280
--- /dev/null
+++ b/tests/xfs/2307.out
@@ -0,0 +1,93 @@
+QA output created by 2307
+
+
+Corrupting rtcsum inode size
+
+Allowing write of corrupted data with good CRC
+core.size = 18
+Checking corrupted file system
+Reading from corrupted file system
+Checking corrupted file system
+Repairing corrupted file system
+Checking repaired file system
+Phase 1 - find and verify superblock...
+Phase 2 - using <TYPEOF> log
+ - zero log...
+ - scan filesystem freespace and inode maps...
+ - found root inode chunk
+Phase 3 - for each AG...
+ - scan (but don't clear) agi unlinked lists...
+ - process known inodes and perform inode discovery...
+ - process newly discovered inodes...
+Phase 4 - check for duplicate blocks...
+ - setting up duplicate extent list...
+ - check for inodes claiming duplicate blocks...
+No modify flag set, skipping phase 5
+Phase 6 - check inode connectivity...
+ - traversing filesystem ...
+ - traversal finished ...
+ - moving disconnected inodes to lost+found ...
+Phase 7 - verify link counts...
+No modify flag set, skipping filesystem flush and exiting.
+Scrubbing repaired file system
+Reading from repaired file system
+
+
+Corrupting rtcsum inode mode
+
+Allowing write of corrupted data with good CRC
+core.mode = 0
+Checking corrupted file system
+Repairing corrupted file system
+Checking repaired file system
+Phase 1 - find and verify superblock...
+Phase 2 - using <TYPEOF> log
+ - zero log...
+ - scan filesystem freespace and inode maps...
+ - found root inode chunk
+Phase 3 - for each AG...
+ - scan (but don't clear) agi unlinked lists...
+ - process known inodes and perform inode discovery...
+ - process newly discovered inodes...
+Phase 4 - check for duplicate blocks...
+ - setting up duplicate extent list...
+ - check for inodes claiming duplicate blocks...
+No modify flag set, skipping phase 5
+Phase 6 - check inode connectivity...
+ - traversing filesystem ...
+ - traversal finished ...
+ - moving disconnected inodes to lost+found ...
+Phase 7 - verify link counts...
+No modify flag set, skipping filesystem flush and exiting.
+Scrubbing repaired file system
+Reading from repaired file system
+
+
+Corrupting rtcsum inode nextents
+
+Allowing write of corrupted data with good CRC
+core.nextents = 2
+Checking corrupted file system
+Repairing corrupted file system
+Checking repaired file system
+Phase 1 - find and verify superblock...
+Phase 2 - using <TYPEOF> log
+ - zero log...
+ - scan filesystem freespace and inode maps...
+ - found root inode chunk
+Phase 3 - for each AG...
+ - scan (but don't clear) agi unlinked lists...
+ - process known inodes and perform inode discovery...
+ - process newly discovered inodes...
+Phase 4 - check for duplicate blocks...
+ - setting up duplicate extent list...
+ - check for inodes claiming duplicate blocks...
+No modify flag set, skipping phase 5
+Phase 6 - check inode connectivity...
+ - traversing filesystem ...
+ - traversal finished ...
+ - moving disconnected inodes to lost+found ...
+Phase 7 - verify link counts...
+No modify flag set, skipping filesystem flush and exiting.
+Scrubbing repaired file system
+Reading from repaired file system
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
` (11 preceding siblings ...)
2026-09-24 10:07 ` [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums Christoph Hellwig
@ 2026-09-24 10:07 ` Christoph Hellwig
2026-09-29 2:03 ` Darrick J. Wong
12 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-09-24 10:07 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Plus handling of corrupted csum files in the kernel as a side effect.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/2308 | 47 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/2308.out | 4 ++++
2 files changed, 51 insertions(+)
create mode 100755 tests/xfs/2308
create mode 100644 tests/xfs/2308.out
diff --git a/tests/xfs/2308 b/tests/xfs/2308
new file mode 100755
index 000000000000..5c4f647ced7a
--- /dev/null
+++ b/tests/xfs/2308
@@ -0,0 +1,47 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2026 Christoph Hellwig.
+#
+# FS QA Test No. 2308
+#
+# Corrupt rtcsum and check that scrub and different kinds of reads catch them.
+#
+. ./common/preamble
+_begin_fstest auto quick zone datacsum scrub
+
+. ./common/filter
+. ./common/fuzzy
+
+_require_scratch_nocheck
+
+_scratch_mkfs >> $seqres.full 2>&1
+_scratch_mount
+_require_xfs_data_csum $TEST_DIR
+
+cat /bin/sh > $SCRATCH_MNT/sh
+sync $SCRATCH_MNT
+
+rg=`xfs_bmap -v $SCRATCH_MNT/sh | _filter_bmap_gno`
+rg="${rg// /}"
+
+_scratch_unmount
+
+$XFS_DB_PROG -x $SCRATCH_DEV \
+ -c "path -m /rtgroups/$rg.csum" \
+ -c 'dblock 0' \
+ -c 'write csums[0] 4266'
+
+_scratch_mount
+$XFS_SCRUB_PROG -x -a 1 $SCRATCH_MNT >> $seqres.full 2>&1
+if [ $? -eq 0 ]; then
+ _fail "scrub did not find corruption"
+fi
+
+# Test buffered I/O
+$XFS_IO_PROG -c 'pread 0 64k' $SCRATCH_MNT/sh
+
+# Test direct I/O
+$XFS_IO_PROG -d -c 'pread 0 64k' $SCRATCH_MNT/sh
+
+status=0
+exit
diff --git a/tests/xfs/2308.out b/tests/xfs/2308.out
new file mode 100644
index 000000000000..55f6a0c97264
--- /dev/null
+++ b/tests/xfs/2308.out
@@ -0,0 +1,4 @@
+QA output created by 2308
+csums[0] = 4266
+pread: Input/output error
+pread: Input/output error
--
2.53.0
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH 01/13] add a "datacsum" group
2026-09-24 10:07 ` [PATCH 01/13] add a "datacsum" group Christoph Hellwig
@ 2026-09-29 1:31 ` Darrick J. Wong
2026-10-05 13:17 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:31 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:42PM +0200, Christoph Hellwig wrote:
> Add a group for test exercising data checksum functionality.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> doc/group-names.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/doc/group-names.txt b/doc/group-names.txt
> index ef6b8f51cf87..101c72688c02 100644
> --- a/doc/group-names.txt
> +++ b/doc/group-names.txt
> @@ -34,6 +34,7 @@ dangerous dangerous test that can crash the system
> dangerous_fuzzers fuzzers that can crash your computer
> dangerous_selftest selftests that crash/hang
> data data loss checkers
> +datacsum data checksumming
Seems like a reasonable addition to me. That said ... I bet at least
btrfs/282 is a data checksum test that's incorrectly in the (metadata)
scrub group.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> dax direct access mode for persistent memory files
> db xfs_db functional tests
> dedupe FIEDEDUPERANGE ioctl
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable
2026-09-24 10:07 ` [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable Christoph Hellwig
@ 2026-09-29 1:32 ` Darrick J. Wong
2026-10-05 13:18 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:32 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:43PM +0200, Christoph Hellwig wrote:
> Add a new SCRATCH_MKFS_OPTIONS variable, which contains options that are
> only applied to the actualy scratch device, but not to various other
> devices like scsi_debug or loop devices created by various test.
>
> This is important to support mkfs options that do not work on arbitrary
> devices, like the extended LBA based data checksum support.
Er... what is "extended LBA based data checskum support"? T10PI?
The addition itself seems reasonable, so
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> README | 2 ++
> common/rc | 4 +++-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/README b/README
> index 8644f163b1ab..cc03f51e1ad3 100644
> --- a/README
> +++ b/README
> @@ -303,6 +303,8 @@ Extra SCRATCH device specifications:
> - Set SCRATCH_LOGDEV to "device for scratch-fs external log"
> - Set SCRATCH_RTDEV to "device for scratch-fs realtime data"
> - If SCRATCH_LOGDEV and/or SCRATCH_RTDEV, the USE_EXTERNAL environment
> + - Set SCRARCH_MKFS_OPTIONS if you want to specify additional mkfs options
> + to be used when creating file system on SCRATCH_DEV.
>
> Tape device specification for xfsdump testing:
> - Set TAPE_DEV to "tape device for testing xfsdump".
> diff --git a/common/rc b/common/rc
> index 3958ac934980..7fc5ff956959 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -805,12 +805,14 @@ _scratch_do_mkfs()
> local mkfs_filter=$2
> shift 2
> local extra_mkfs_options=$*
> + local mkfs_options
> local mkfs_status
> local tmp=`mktemp -u`
>
> # save mkfs output in case conflict means we need to run again.
> # only the output for the mkfs that applies should be shown
> - eval "$mkfs_cmd $MKFS_OPTIONS $extra_mkfs_options $SCRATCH_DEV" \
> + mkfs_options="$MKFS_OPTIONS $SCRATCH_MKFS_OPTIONS $extra_mkfs_options"
> + eval "$mkfs_cmd $mkfs_options $SCRATCH_DEV" \
> 2>$tmp.mkfserr 1>$tmp.mkfsstd
> mkfs_status=$?
>
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable
2026-09-24 10:07 ` [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable Christoph Hellwig
@ 2026-09-29 1:34 ` Darrick J. Wong
0 siblings, 0 replies; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:34 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:44PM +0200, Christoph Hellwig wrote:
> Add an option to run the end of testt xfs_scrub call using the -x
test
> option to also check file data validity.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> README | 3 +++
> common/xfs | 8 +++++++-
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/README b/README
> index cc03f51e1ad3..0ce7d4463354 100644
> --- a/README
> +++ b/README
> @@ -326,6 +326,9 @@ Extra XFS specification:
> - xfs_scrub, if present, will always check the test and scratch
> filesystems if they are still online at the end of the test. It is no
> longer necessary to set TEST_XFS_SCRUB.
> + - Set XFS_VERIFY_FILE_DATA option to also check file data integrity using the
> + -x option to xfs_scrub. This makes the xfs_scrub based checks a lot slower,
> + but verifies the data checksum support in XFS.
>
> Tools specification:
> - dump:
> diff --git a/common/xfs b/common/xfs
> index 98981e624dda..8254e48603af 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -875,6 +875,12 @@ _check_xfs_filesystem()
> # Run online scrub if we can.
> mntpt="$(_is_dev_mounted $device)"
> if [ -n "$mntpt" ] && _supports_xfs_scrub "$mntpt" "$device"; then
> + local xfs_scrub_opts="-v -d -n"
> +
> + if [ -n "$XFS_VERIFY_FILE_DATA" ]; then
> + xfs_scrub_opts="$xfs_scrub_opts -x"
> + fi
/me wonders if you should use bash arrays here but seeing as we just got
burned by that I'll defer to Zorro if he prefers that or not.
With the typo fixed, this looks ok to me.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> +
> can_scrub=1
>
> # Tests can create a scenario in which a call to syncfs() issued
> @@ -888,7 +894,7 @@ _check_xfs_filesystem()
> # before executing a scrub operation.
> $XFS_IO_PROG -c syncfs $mntpt >> $seqres.full 2>&1
>
> - "$XFS_SCRUB_PROG" -v -d -n $mntpt > $tmp.scrub 2>&1
> + "$XFS_SCRUB_PROG" $xfs_scrub_opts $mntpt > $tmp.scrub 2>&1
> if [ $? -ne 0 ]; then
> _log_err "_check_xfs_filesystem: filesystem on $device failed scrub"
> echo "*** xfs_scrub -v -d -n output ***" >> $seqres.full
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 04/13] xfs/206: filter out csum information from mkfs output
2026-09-24 10:07 ` [PATCH 04/13] xfs/206: filter out csum information from mkfs output Christoph Hellwig
@ 2026-09-29 1:34 ` Darrick J. Wong
0 siblings, 0 replies; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:34 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:45PM +0200, Christoph Hellwig wrote:
> To make the test work with csum-enabled mkfs.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Ugh, I hate this test. But it makes sense.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> tests/xfs/206 | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/xfs/206 b/tests/xfs/206
> index a515c6c8838c..f5e0b1404732 100755
> --- a/tests/xfs/206
> +++ b/tests/xfs/206
> @@ -67,6 +67,7 @@ mkfs_filter()
> -e 's/, parent=[01]//' \
> -e '/rgcount=/d' \
> -e '/zoned=/d' \
> + -e '/csum=/d' \
> -e "/^Default configuration/d"
> }
>
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper
2026-09-24 10:07 ` [PATCH 05/13] xfs: add a _require_xfs_data_csum helper Christoph Hellwig
@ 2026-09-29 1:38 ` Darrick J. Wong
2026-10-05 13:20 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:38 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:46PM +0200, Christoph Hellwig wrote:
> Add a helper to check if a given mountpoint supports (RT) data checksums
> on XFS.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> common/xfs | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/common/xfs b/common/xfs
> index 8254e48603af..e9f6877c98cd 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -2448,3 +2448,16 @@ _require_xfs_healer()
>
> _scratch_mkfs_xfs_supported "$arg" concurrency=0
> }
> +
> +# require (RT) data checksum support on the passed mountpoint
> +_require_xfs_data_csum()
> +{
> + mnt=$1
> +
> + csumval=$($XFS_IO_PROG -c 'statfs -g' $mnt | \
> + grep "geom.rtcsum_type" | awk '{print $3}')
> + echo "csumval: $csumval" >> $seqres.full
> + if [ -e "$csumval" -o "$csumval" -eq "0" ]; then
> + _notrun "requires XFS data checsums"
checksums
Any chance we could export file data checksum type via statx or
somewhere?
With the typo fixed,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> + fi
> +}
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 06/13] xfs/2301: test lazy bounce buffering mode
2026-09-24 10:07 ` [PATCH 06/13] xfs/2301: test lazy bounce buffering mode Christoph Hellwig
@ 2026-09-29 1:42 ` Darrick J. Wong
2026-10-05 13:21 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:47PM +0200, Christoph Hellwig wrote:
> Run fsx (based on generic/091) while injecting lazy bounce buffer
> retries for reads.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2301 | 43 +++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2301.out | 13 +++++++++++++
> 2 files changed, 56 insertions(+)
> create mode 100755 tests/xfs/2301
> create mode 100644 tests/xfs/2301.out
>
> diff --git a/tests/xfs/2301 b/tests/xfs/2301
> new file mode 100755
> index 000000000000..605510c6dbc8
> --- /dev/null
> +++ b/tests/xfs/2301
> @@ -0,0 +1,43 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
> +# Copyright (c) 2026 Christoph Hellwig.
> +#
> +# FS QA Test No. 2301
> +#
> +# Run fsx with error injection for re-retries with bounce buffers, simulating
Aren't these just retries?
> +# users modifying the in-flight data buffer.
> +#
> +. ./common/preamble
> +_begin_fstest rw auto quick datacsum
> +
> +. ./common/filter
> +. ./common/inject
> +
> +_require_test
> +_require_odirect
> +_require_xfs_data_csum $TEST_DIR
> +
> +psize=`$here/src/feature -s`
> +bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
> +
> +_test_inject_error bounce_reread 100
Were it not for this I'd say this should be a generic test. But I guess
generic/091 tests the no-bounce code paths just fine, right?
> +# fsx load similar to generic/091
> +echo "Testing direct I/O"
> +run_fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +run_fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +run_fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +run_fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +run_fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +run_fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +
> +# fsx load similar to generic/091 but using buffered I/O
> +echo "Testing buffered I/O"
> +run_fsx -N 10000 -l 500000
> +run_fsx -N 10000 -o 8192 -l 500000
> +run_fsx -N 10000 -o 32768 -l 500000
> +run_fsx -N 10000 -o 128000 -l 500000
> +
> +status=0
> +exit
_exit 0
--D
> diff --git a/tests/xfs/2301.out b/tests/xfs/2301.out
> new file mode 100644
> index 000000000000..221a3185970c
> --- /dev/null
> +++ b/tests/xfs/2301.out
> @@ -0,0 +1,13 @@
> +QA output created by 2301
> +Testing direct I/O
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 07/13] xfs/2302: add a basic data checksum test
2026-09-24 10:07 ` [PATCH 07/13] xfs/2302: add a basic data checksum test Christoph Hellwig
@ 2026-09-29 1:48 ` Darrick J. Wong
2026-10-05 13:22 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:48PM +0200, Christoph Hellwig wrote:
> Setup a zoned loop device, mess up the data and make sure both buffered
> and direct I/O catch it.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2302 | 96 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2302.out | 25 ++++++++++++
> 2 files changed, 121 insertions(+)
> create mode 100755 tests/xfs/2302
> create mode 100644 tests/xfs/2302.out
>
> diff --git a/tests/xfs/2302 b/tests/xfs/2302
> new file mode 100755
> index 000000000000..d0ef9abc87b0
> --- /dev/null
> +++ b/tests/xfs/2302
> @@ -0,0 +1,96 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 Christoph Hellwig
> +#
> +# FS QA Test No. 2302
> +#
> +# Test that data checksums detect data corruption using all three bounce
> +# buffering modes.
> +#
> +. ./common/preamble
> +. ./common/filter
> +. ./common/zoned
> +
> +_begin_fstest auto zone quick datacsum
> +
> +cleanup_devices()
> +{
> + [ -n "$mnt" ] && _unmount $mnt 2>/dev/null
> + [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
> + _destroy_zloop $zloop_dev
> + cd /
> + rm -rf $loopfile $zloopdir $mnt
> +}
> +
> +_cleanup()
> +{
> + cleanup_devices
> +}
> +
> +_require_test
> +_require_loop
> +_require_zloop
> +# hack to only run for block based file systems
> +_require_block_device $SCRATCH_DEV
What XFS filesystem isn't block-based?
> +
> +loopfile="$TEST_DIR/loopfile"
> +zloopdir="$TEST_DIR/zloop"
> +mnt="$TEST_DIR/mnt"
> +
> +test_error_detection()
> +{
> + local bounce_mode=$1
> +
> + echo
> + echo
> + echo "Testing bounce mode: $bounce_mode"
> + echo
> +
> + rm -rf $loopfile $zloopdir $mnt
> + mkdir -p $mnt
> + truncate -s 1g $loopfile
> +
> + local loop_dev=$(_create_loop_device $loopfile)
> + local zloop_dev=$(_create_zloop $zloopdir 256 0)
> + local zloop_id=$(echo $zloop_dev | grep -oE '[0-9]+$')
> +
> + _try_mkfs_dev $loop_dev -r rtdev=$zloop_dev,csum=crc32c \
> + >> $seqres.full 2>&1 || \
> + _notrun "cannot mkfs filesystem with data checksums"
> + _mount $loop_dev -o rtdev=$zloop_dev $mnt
> +
> + dd if=/dev/urandom of=$mnt/file bs=1M count=200 conv=fsync >/dev/null 2>&1
> +
> + local rg=`xfs_bmap -v $mnt/file | head -n 3 | _filter_bmap_gno`
> + local zloop_filename=$(printf "seq-%06u\n" $rg)
> + local backing_file="$zloopdir/$zloop_id/$zloop_filename"
> +
> + _unmount $mnt 2>/dev/null
> +
> + # intentionally corrupt the data on the backing device
> + xfs_io $backing_file -d -c 'pwrite 0 16384' >> $seqres.full 2>&1
$XFS_IO_PROG here and elsewhere
> +
> + # should return an error on buffered read
> + _mount $loop_dev -o rtdev=$zloop_dev $mnt
> + _set_fs_sysfs_attr $loop_dev csum/read_bounce $bounce_mode
> + echo "Reading file using cat - should fail"
> + cat $mnt/file > /dev/null | _filter_test_dir
> +
> + sleep 1
> + _unmount $mnt 2>/dev/null
> +
> + # same with direct I/O
> + _mount $loop_dev -o rtdev=$zloop_dev $mnt
> + _set_fs_sysfs_attr $loop_dev csum/read_bounce $bounce_mode
> + echo "Reading file using O_DIRECT - should fail"
> + xfs_io -d $mnt/file -c 'pread 0 200M' | _filter_test_dir
> +
> + sleep 1
> + cleanup_devices
> +}
> +
> +test_error_detection "never"
> +test_error_detection "always"
> +test_error_detection "lazy"
> +
> +_exit 0
> diff --git a/tests/xfs/2302.out b/tests/xfs/2302.out
> new file mode 100644
> index 000000000000..5e2108b5cec0
> --- /dev/null
> +++ b/tests/xfs/2302.out
> @@ -0,0 +1,25 @@
> +QA output created by 2302
> +
> +
> +Testing bounce mode: never
> +
> +Reading file using cat - should fail
> +cat: /mnt/test/mnt/file: Input/output error
You need to _filter_test this out of the golden output.
Other than those complaints, I think this is a good functional test for
the xfs data checksum support.
--D
> +Reading file using O_DIRECT - should fail
> +pread: Input/output error
> +
> +
> +Testing bounce mode: always
> +
> +Reading file using cat - should fail
> +cat: /mnt/test/mnt/file: Input/output error
> +Reading file using O_DIRECT - should fail
> +pread: Input/output error
> +
> +
> +Testing bounce mode: lazy
> +
> +Reading file using cat - should fail
> +cat: /mnt/test/mnt/file: Input/output error
> +Reading file using O_DIRECT - should fail
> +pread: Input/output error
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement
2026-09-24 10:07 ` [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement Christoph Hellwig
@ 2026-09-29 1:54 ` Darrick J. Wong
2026-10-05 13:23 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:54 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:49PM +0200, Christoph Hellwig wrote:
> Test that data checksums detect data corruption due to misplacement
> by changing the backing files for two zones using the zloop driver.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2303 | 88 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2303.out | 5 +++
> 2 files changed, 93 insertions(+)
> create mode 100755 tests/xfs/2303
> create mode 100644 tests/xfs/2303.out
>
> diff --git a/tests/xfs/2303 b/tests/xfs/2303
> new file mode 100755
> index 000000000000..7f53fdf94bff
> --- /dev/null
> +++ b/tests/xfs/2303
> @@ -0,0 +1,88 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 Christoph Hellwig
> +#
> +# FS QA Test No. 2303
> +#
> +# Test that data checksums detect data corruption due to misplacement
> +# by changing the backing files for two zones using the zloop driver.
> +#
> +. ./common/preamble
> +. ./common/filter
> +. ./common/renameat2
> +. ./common/zoned
> +
> +_begin_fstest auto zone quick datacsum
> +
> +_cleanup()
> +{
> + [ -n "$mnt" ] && _unmount $mnt 2>/dev/null
> + [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
> + _destroy_zloop $zloop_dev
> + cd /
> + rm -rf $loopfile $zloopdir $mnt
> +}
> +
> +_require_test
> +_require_renameat2 "exchange"
> +_require_loop
> +_require_zloop
> +# hack to only run for block based file systems
> +_require_block_device $SCRATCH_DEV
> +
> +loopfile="$TEST_DIR/loopfile"
> +zloopdir="$TEST_DIR/zloop"
> +mnt="$TEST_DIR/mnt"
> +
> +rm -rf $loopfile $zloopdir $mnt
> +mkdir -p $mnt
> +truncate -s 1g $loopfile
> +
> +loop_dev=$(_create_loop_device $loopfile)
> +zloop_dev=$(_create_zloop $zloopdir 256 0)
> +zloop_id=$(echo $zloop_dev | grep -oE '[0-9]+$')
> +
> +_try_mkfs_dev $loop_dev -r rtdev=$zloop_dev,csum=crc32c \
> + >> $seqres.full 2>&1 || \
> + _notrun "cannot mkfs filesystem with data checksums"
> +_mount $loop_dev -o rtdev=$zloop_dev $mnt
> +
> +dd if=/dev/urandom of=$mnt/file1 bs=4k count=1 conv=fsync >/dev/null 2>&1
> +dd if=/dev/zero of=$mnt/file2 bs=4k count=1 conv=fsync >/dev/null 2>&1
> +
> +xfs_bmap -v $mnt/file1 >> $seqres.full 2>&1
> +xfs_bmap -v $mnt/file2 >> $seqres.full 2>&1
> +
> +rg1=`xfs_bmap -v $mnt/file1 | head -n 3 | _filter_bmap_gno`
> +rg2=`xfs_bmap -v $mnt/file2 | head -n 3 | _filter_bmap_gno`
> +if [ "$rg1" == "$rg2" ]; then
> + _fail "both files placed in same RG: $rg1 $rg2"
> +fi
> +
> +zloop_filename1=$(printf "seq-%06u\n" $rg1)
> +backing_file1="$zloopdir/$zloop_id/$zloop_filename1"
> +zloop_filename2=$(printf "seq-%06u\n" $rg2)
> +backing_file2="$zloopdir/$zloop_id/$zloop_filename2"
> +
> +_unmount $mnt 2>/dev/null
> +_destroy_zloop $zloop_dev
> +
> +# intentionally corrupt data by swapping the two zone files
> +ls -i $backing_file1 $backing_file2 >> $seqres.full
> +echo "swapping file $backing_file1 and $backing_file2" >> $seqres.full
> +$here/src/renameat2 -x $backing_file1 $backing_file2
> +ls -i $backing_file1 $backing_file2 >> $seqres.full
Heh, this is an amusing way to induce a data checksum verification
failure -- switching the zone backing files. :) Given that one of the
previous tests directly writes to the rt dev I think this one is less
important, but I guess that's one way to simulate an evil-maid device.
(Same nitpicks as the previous test)
--D
> +
> +zloop_dev=$(_create_zloop $zloopdir 256 0)
> +zloop_id=$(echo $zloop_dev | grep -oE '[0-9]+$')
> +_mount $loop_dev -o rtdev=$zloop_dev $mnt
> +
> +# should return an error on buffered read
> +echo "Reading file1 using cat - should fail"
> +cat $mnt/file1 > /dev/null | _filter_test_dir
> +
> +# same with direct I/O
> +echo "Reading file2 using O_DIRECT - should fail"
> +xfs_io -d $mnt/file2 -c 'pread 0 200M' | _filter_test_dir
> +
> +_exit 0
> diff --git a/tests/xfs/2303.out b/tests/xfs/2303.out
> new file mode 100644
> index 000000000000..fca2c4830e3c
> --- /dev/null
> +++ b/tests/xfs/2303.out
> @@ -0,0 +1,5 @@
> +QA output created by 2303
> +Reading file1 using cat - should fail
> +cat: /mnt/test/mnt/file1: Input/output error
> +Reading file2 using O_DIRECT - should fail
> +pread: Input/output error
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-09-24 10:07 ` [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration Christoph Hellwig
@ 2026-09-29 1:56 ` Darrick J. Wong
2026-10-05 13:25 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:56 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:50PM +0200, Christoph Hellwig wrote:
> To check both the metadata integrity and file system checksums after
> log replay.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2304 | 61 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2304.out | 2 ++
> 2 files changed, 63 insertions(+)
> create mode 100755 tests/xfs/2304
> create mode 100644 tests/xfs/2304.out
>
> diff --git a/tests/xfs/2304 b/tests/xfs/2304
> new file mode 100755
> index 000000000000..ad4f45d79057
> --- /dev/null
> +++ b/tests/xfs/2304
> @@ -0,0 +1,61 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
> +#
> +# FS QA Test No. 2304
> +#
> +# Copied from generic/388, with added xfs_scrub -x calls for each iteration to
> +# verify the integrity of all file data and metadata.
> +#
> +# Test XFS log recovery ordering on v5 superblock filesystems. XFS had a problem
> +# where it would incorrectly replay older modifications from the log over more
> +# recent versions of metadata due to failure to update metadata LSNs during log
> +# recovery. This could result in false positive reports of corruption during log
> +# recovery and permanent mount failure.
> +#
> +# To test this situation, run frequent shutdowns immediately after log recovery.
> +# Ensure that log recovery does not recover stale modifications and cause
> +# spurious corruption reports and/or mount failures.
> +#
> +. ./common/preamble
> +_begin_fstest shutdown auto log metadata recoveryloop datacsum
> +
> +_require_scratch
> +_require_local_device $SCRATCH_DEV
> +_require_scratch_shutdown
> +
> +echo "Silence is golden."
> +
> +_scratch_mkfs >> $seqres.full 2>&1
> +_require_metadata_journaling $SCRATCH_DEV
> +_scratch_mount
> +_require_scratch_xfs_scrub
> +
> +while _soak_loop_running $((50 * TIME_FACTOR)); do
> + _run_fsstress_bg -d $SCRATCH_MNT -n 999999 -p 4
> +
> + # purposely include 0 second sleeps to test shutdown immediately after
> + # recovery
> + sleep $((RANDOM % 3))
> + _scratch_shutdown
> +
> + _kill_fsstress
> +
> + # Toggle between rw and ro mounts for recovery. Quit if any mount
> + # attempt fails so we don't shutdown the host fs.
> + if [ $((RANDOM % 2)) -eq 0 ]; then
> + _scratch_cycle_mount || _fail "cycle mount failed"
> + else
> + _scratch_cycle_mount "ro" || _fail "cycle ro mount failed"
> + _scratch_cycle_mount || _fail "cycle rw mount failed"
> + fi
> +
> + $XFS_SCRUB_PROG -x $SCRATCH_MNT >> $seqres.full 2>&1
I think we should just change generic/388 to run xfs_scrub after
recovery, and add -x if data checksums are enabled? That /would/ have
the effect of catching recovery errors (or scrub bugs) earlier.
Though I wonder how much that reduces the number of loop iterations over
a given SOAK_DURATION?
--D
> + if [ $? -ne 0 ]; then
> + _fail "scrub found errors"
> + fi
> +done
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/2304.out b/tests/xfs/2304.out
> new file mode 100644
> index 000000000000..07ee489db9fa
> --- /dev/null
> +++ b/tests/xfs/2304.out
> @@ -0,0 +1,2 @@
> +QA output created by 2304
> +Silence is golden.
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 10/13] xfs/2305: version of generic/475 that run xfs_scrub -x for each iteration
2026-09-24 10:07 ` [PATCH 10/13] xfs/2305: version of generic/475 " Christoph Hellwig
@ 2026-09-29 1:57 ` Darrick J. Wong
2026-10-05 13:25 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:57 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:51PM +0200, Christoph Hellwig wrote:
> To check both the metadata integrity and file system checksums after
> log replay.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2305 | 75 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2305.out | 2 ++
> 2 files changed, 77 insertions(+)
> create mode 100755 tests/xfs/2305
> create mode 100644 tests/xfs/2305.out
>
> diff --git a/tests/xfs/2305 b/tests/xfs/2305
> new file mode 100755
> index 000000000000..277f81c13887
> --- /dev/null
> +++ b/tests/xfs/2305
> @@ -0,0 +1,75 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
> +#
> +# FS QA Test No. 2305
> +#
> +# Copied from generic/475, with added xfs_scrub -x calls for each iteration to
> +# verify the integrity of all file data and metadata.
Same questions that I had for xfs/2304. :D
--D
> +# Test log recovery with repeated (simulated) disk failures. We kick
> +# off fsstress on the scratch fs, then switch out the underlying device
> +# with dm-error to see what happens when the disk goes down. Having
> +# taken down the fs in this manner, remount it and repeat. This test
> +# is a Good Enough (tm) simulation of our internal multipath failure
> +# testing efforts.
> +#
> +. ./common/preamble
> +_begin_fstest shutdown auto log metadata eio recoveryloop smoketest datacsum
> +
> +# Override the default cleanup function.
> +_cleanup()
> +{
> + _kill_fsstress
> + _dmerror_unmount
> + _dmerror_cleanup
> + cd /
> + rm -f $tmp.*
> +}
> +
> +# Import common functions.
> +. ./common/dmerror
> +
> +# Modify as appropriate.
> +
> +_require_scratch
> +_require_dm_target error
> +
> +echo "Silence is golden."
> +
> +_scratch_mkfs >> $seqres.full 2>&1
> +_require_metadata_journaling $SCRATCH_DEV
> +_dmerror_init
> +_dmerror_mount
> +
> +while _soak_loop_running $((50 * TIME_FACTOR)); do
> + _run_fsstress_bg -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4))
> +
> + # purposely include 0 second sleeps to test shutdown immediately after
> + # recovery
> + sleep $((RANDOM % 3))
> +
> + # This test aims to simulate sudden disk failure, which means that we
> + # do not want to quiesce the filesystem or otherwise give it a chance
> + # to flush its logs. Therefore we want to call dmsetup with the
> + # --nolockfs parameter; to make this happen we must call the load
> + # error table helper *without* 'lockfs'.
> + _dmerror_load_error_table
> +
> + _kill_fsstress
> +
> + # Mount again to replay log after loading working table, so we have a
> + # consistent XFS after test.
> + _dmerror_unmount || _fail "unmount failed"
> + _dmerror_load_working_table
> + _dmerror_mount || _fail "mount failed"
> +
> + $XFS_SCRUB_PROG -x $SCRATCH_MNT >> $seqres.full 2>&1
> + if [ $? -ne 0 ]; then
> + _fail "scrub found errors"
> + fi
> +done
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/2305.out b/tests/xfs/2305.out
> new file mode 100644
> index 000000000000..8265227294ca
> --- /dev/null
> +++ b/tests/xfs/2305.out
> @@ -0,0 +1,2 @@
> +QA output created by 2305
> +Silence is golden.
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options
2026-09-24 10:07 ` [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options Christoph Hellwig
@ 2026-09-29 1:59 ` Darrick J. Wong
2026-10-05 13:26 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 1:59 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:52PM +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2306 | 50 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2306.out | 20 +++++++++++++++++++
> 2 files changed, 70 insertions(+)
> create mode 100755 tests/xfs/2306
> create mode 100644 tests/xfs/2306.out
>
> diff --git a/tests/xfs/2306 b/tests/xfs/2306
> new file mode 100755
> index 000000000000..76dac5bb2a69
> --- /dev/null
> +++ b/tests/xfs/2306
> @@ -0,0 +1,50 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2026 Christoph Hellwig.
> +#
> +# FS QA Test No. 2306
> +#
> +# Test mkfs input checking for the csum and csumbsize options.
I wonder if you want -N so that *only* the options parsing occurs?
That would speed up this test by skipping the actual writes.
OTOH it's useful to test writing out the rtcsum files...
--D
> +#
> +. ./common/preamble
> +_begin_fstest auto quick mkfs zone datacsum
> +
> +. ./common/filter
> +
> +_require_scratch_nocheck
> +
> +expect_fail()
> +{
> + opts=$1
> + msg=$2
> +
> + echo "Testing $msg (expect failure)"
> + $MKFS_XFS_PROG -f $opts $SCRATCH_DEV 2>&1 | head -n1
> +}
> +
> +expect_fail "-r csum=crc32c" "csum option without zoned"
> +expect_fail "-r csumbsize=32k" "csumbsize option without zoned"
> +expect_fail "-r zoned,csum=crc16" "invalid csum value"
> +expect_fail "-r zoned,csum=crc32c,csumbsize=1k" "too small csumbsize"
> +expect_fail "-r zoned,csum=crc32c,csumbsize=48k" "non-pow2 csumbsize"
> +expect_fail "-r zoned,csum=crc32c,csumbsize=128k" "too large csumbsize"
> +expect_fail "-b size=64k -r zoned,csum=crc32c,csumbsize=32k" "csumbsize < bsize"
> +
> +expect_pass()
> +{
> + opts=$1
> + msg=$2
> +
> + echo "Testing $msg (expect pass)"
> + $MKFS_XFS_PROG -f $opts $SCRATCH_DEV >> $seqres.full 2>&1 || \
> + _fail "could not mkfs for $opts"
> +}
> +
> +expect_pass "-r zoned,csum=none" "csum=none"
> +expect_pass "-r zoned,csum=crc32c" "csum=crc32c"
> +expect_pass "-r zoned,csum=crc64" "csum=crc64"
> +expect_pass "-r zoned,csum=crc64,csumbsize=32k" "csum=crc64,csumbsize=32k"
> +expect_pass "-r zoned,csum=crc64,csumbsize=64k" "csum=crc64,csumbsize=64k"
> +
> +status=0
> +exit
> diff --git a/tests/xfs/2306.out b/tests/xfs/2306.out
> new file mode 100644
> index 000000000000..5e79103212ad
> --- /dev/null
> +++ b/tests/xfs/2306.out
> @@ -0,0 +1,20 @@
> +QA output created by 2306
> +Testing csum option without zoned (expect failure)
> +data checksums not supported without zoned mode
> +Testing csumbsize option without zoned (expect failure)
> +RT data csum block size options requires RT data csum type.
> +Testing invalid csum value (expect failure)
> +unknown option -r crc16
> +Testing too small csumbsize (expect failure)
> +Invalid value 1k for -r csumbsize option. Value is too small.
> +Testing non-pow2 csumbsize (expect failure)
> +RT data csum block size of 49152 bytes is not a power of 2
> +Testing too large csumbsize (expect failure)
> +Invalid value 128k for -r csumbsize option. Value is too large.
> +Testing csumbsize < bsize (expect failure)
> +RT data csum block size of 32768 bytes is smaller than fsblock size 65536.
> +Testing csum=none (expect pass)
> +Testing csum=crc32c (expect pass)
> +Testing csum=crc64 (expect pass)
> +Testing csum=crc64,csumbsize=32k (expect pass)
> +Testing csum=crc64,csumbsize=64k (expect pass)
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair
2026-09-24 10:07 ` [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair Christoph Hellwig
@ 2026-09-29 2:03 ` Darrick J. Wong
2026-10-05 13:27 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 2:03 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:54PM +0200, Christoph Hellwig wrote:
> Plus handling of corrupted csum files in the kernel as a side effect.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2308 | 47 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2308.out | 4 ++++
> 2 files changed, 51 insertions(+)
> create mode 100755 tests/xfs/2308
> create mode 100644 tests/xfs/2308.out
>
> diff --git a/tests/xfs/2308 b/tests/xfs/2308
> new file mode 100755
> index 000000000000..5c4f647ced7a
> --- /dev/null
> +++ b/tests/xfs/2308
> @@ -0,0 +1,47 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2026 Christoph Hellwig.
> +#
> +# FS QA Test No. 2308
> +#
> +# Corrupt rtcsum and check that scrub and different kinds of reads catch them.
Heh ok here's the real meat :D
> +#
> +. ./common/preamble
> +_begin_fstest auto quick zone datacsum scrub
> +
> +. ./common/filter
> +. ./common/fuzzy
> +
> +_require_scratch_nocheck
> +
> +_scratch_mkfs >> $seqres.full 2>&1
> +_scratch_mount
> +_require_xfs_data_csum $TEST_DIR
> +
> +cat /bin/sh > $SCRATCH_MNT/sh
> +sync $SCRATCH_MNT
> +
> +rg=`xfs_bmap -v $SCRATCH_MNT/sh | _filter_bmap_gno`
> +rg="${rg// /}"
> +
> +_scratch_unmount
> +
> +$XFS_DB_PROG -x $SCRATCH_DEV \
> + -c "path -m /rtgroups/$rg.csum" \
> + -c 'dblock 0' \
> + -c 'write csums[0] 4266'
> +
> +_scratch_mount
> +$XFS_SCRUB_PROG -x -a 1 $SCRATCH_MNT >> $seqres.full 2>&1
> +if [ $? -eq 0 ]; then
> + _fail "scrub did not find corruption"
> +fi
> +
> +# Test buffered I/O
> +$XFS_IO_PROG -c 'pread 0 64k' $SCRATCH_MNT/sh
> +
> +# Test direct I/O
> +$XFS_IO_PROG -d -c 'pread 0 64k' $SCRATCH_MNT/sh
Should this also run xfs_repair to make sure that it also notices the
checksum validation errors?
--D
> +
> +status=0
> +exit
> diff --git a/tests/xfs/2308.out b/tests/xfs/2308.out
> new file mode 100644
> index 000000000000..55f6a0c97264
> --- /dev/null
> +++ b/tests/xfs/2308.out
> @@ -0,0 +1,4 @@
> +QA output created by 2308
> +csums[0] = 4266
> +pread: Input/output error
> +pread: Input/output error
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums
2026-09-24 10:07 ` [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums Christoph Hellwig
@ 2026-09-29 2:05 ` Darrick J. Wong
2026-10-05 13:27 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-09-29 2:05 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Thu, Sep 24, 2026 at 12:07:53PM +0200, Christoph Hellwig wrote:
> Inject errors into the rtcsum files and check that the kernel handles
> them gracefully and that repair fixes them, rebuilding the checksums if
> needed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/xfs/2307 | 106 +++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/2307.out | 93 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 199 insertions(+)
> create mode 100755 tests/xfs/2307
> create mode 100644 tests/xfs/2307.out
>
> diff --git a/tests/xfs/2307 b/tests/xfs/2307
> new file mode 100755
> index 000000000000..47d5be36623d
> --- /dev/null
> +++ b/tests/xfs/2307
> @@ -0,0 +1,106 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2026 Christoph Hellwig.
> +#
> +# FS QA Test No. 2307
> +#
> +# Inject errors into the rtcsum files and check that the kernel handles
> +# them gracefully and that repair fixes them, rebuilding the checksums if
> +# needed.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick repair zone datacsum
> +
> +. ./common/filter
> +. ./common/repair
> +
> +_require_scratch_nocheck
> +
> +
> +prepare_fs()
> +{
> + _scratch_mkfs >> $seqres.full 2>&1
> + _scratch_mount
> + _require_xfs_data_csum $TEST_DIR
> + cat /bin/sh > $SCRATCH_MNT/sh
> + _scratch_unmount
> +}
> +
> +exercise_repair()
> +{
> + echo "Checking corrupted file system"
> + _scratch_xfs_repair -P -n >> $seqres.full 2>&1
> +
> + echo "Repairing corrupted file system"
> + _scratch_xfs_repair -P >> $seqres.full 2>&1
> +}
> +
> +check_corrupted()
> +{
> + echo "Checking corrupted file system"
> + _scratch_xfs_repair -P -n >> $seqres.full 2>&1
> + if [ $? -eq 0 ]; then
> + _fail "xfs_repair -n succeeded"
> + fi
> +
> + _scratch_mount
> +
> + echo "Reading from corrupted file system"
> + cmp /bin/sh $SCRATCH_MNT/sh
> + _scratch_unmount
> +}
> +
> +check_fixed()
> +{
> + echo "Checking repaired file system"
> + _scratch_xfs_repair -P -n 2>&1 | _filter_repair
> +
> + _scratch_mount
> +
> + echo "Scrubbing repaired file system"
> + $XFS_SCRUB_PROG -x -a 0 $SCRATCH_MNT >> $seqres.full
> + if [ $? -ne 0 ]; then
> + _fail "xfs_scrub failed"
> + fi
> +
> + echo "Reading from repaired file system"
> + cmp /bin/sh $SCRATCH_MNT/sh
> + _scratch_unmount
> +}
> +
> +echo
> +echo
> +echo "Corrupting rtcsum inode size"
> +echo
> +prepare_fs
> +_scratch_xfs_set_metadata_field core.size 18 "path -m /rtgroups/0.csum"
> +check_corrupted
> +exercise_repair
> +check_fixed
> +
> +echo
> +echo
> +echo "Corrupting rtcsum inode mode"
> +echo
> +prepare_fs
> +_scratch_xfs_set_metadata_field core.mode 0 "path -m /rtgroups/0.csum"
> +if _try_scratch_mount >>$seqres.full 2>&1; then
> + _fail "mount succeeded with corrupted nextents"
> +fi
> +exercise_repair
> +check_fixed
> +
> +echo
> +echo
> +echo "Corrupting rtcsum inode nextents"
> +echo
> +prepare_fs
> +_scratch_xfs_set_metadata_field core.nextents 2 "path -m /rtgroups/0.csum"
> +if _try_scratch_mount >>$seqres.full 2>&1; then
> + _fail "mount succeeded with corrupted nextents"
> +fi
> +exercise_repair
> +check_fixed
Want to try something wild and less obvious like ... shrinking one of
the extent maps so that there's a sparse hole in the rtcsum file?
--D
> +
> +status=0
> +exit
> diff --git a/tests/xfs/2307.out b/tests/xfs/2307.out
> new file mode 100644
> index 000000000000..2016c27ee280
> --- /dev/null
> +++ b/tests/xfs/2307.out
> @@ -0,0 +1,93 @@
> +QA output created by 2307
> +
> +
> +Corrupting rtcsum inode size
> +
> +Allowing write of corrupted data with good CRC
> +core.size = 18
> +Checking corrupted file system
> +Reading from corrupted file system
> +Checking corrupted file system
> +Repairing corrupted file system
> +Checking repaired file system
> +Phase 1 - find and verify superblock...
> +Phase 2 - using <TYPEOF> log
> + - zero log...
> + - scan filesystem freespace and inode maps...
> + - found root inode chunk
> +Phase 3 - for each AG...
> + - scan (but don't clear) agi unlinked lists...
> + - process known inodes and perform inode discovery...
> + - process newly discovered inodes...
> +Phase 4 - check for duplicate blocks...
> + - setting up duplicate extent list...
> + - check for inodes claiming duplicate blocks...
> +No modify flag set, skipping phase 5
> +Phase 6 - check inode connectivity...
> + - traversing filesystem ...
> + - traversal finished ...
> + - moving disconnected inodes to lost+found ...
> +Phase 7 - verify link counts...
> +No modify flag set, skipping filesystem flush and exiting.
> +Scrubbing repaired file system
> +Reading from repaired file system
> +
> +
> +Corrupting rtcsum inode mode
> +
> +Allowing write of corrupted data with good CRC
> +core.mode = 0
> +Checking corrupted file system
> +Repairing corrupted file system
> +Checking repaired file system
> +Phase 1 - find and verify superblock...
> +Phase 2 - using <TYPEOF> log
> + - zero log...
> + - scan filesystem freespace and inode maps...
> + - found root inode chunk
> +Phase 3 - for each AG...
> + - scan (but don't clear) agi unlinked lists...
> + - process known inodes and perform inode discovery...
> + - process newly discovered inodes...
> +Phase 4 - check for duplicate blocks...
> + - setting up duplicate extent list...
> + - check for inodes claiming duplicate blocks...
> +No modify flag set, skipping phase 5
> +Phase 6 - check inode connectivity...
> + - traversing filesystem ...
> + - traversal finished ...
> + - moving disconnected inodes to lost+found ...
> +Phase 7 - verify link counts...
> +No modify flag set, skipping filesystem flush and exiting.
> +Scrubbing repaired file system
> +Reading from repaired file system
> +
> +
> +Corrupting rtcsum inode nextents
> +
> +Allowing write of corrupted data with good CRC
> +core.nextents = 2
> +Checking corrupted file system
> +Repairing corrupted file system
> +Checking repaired file system
> +Phase 1 - find and verify superblock...
> +Phase 2 - using <TYPEOF> log
> + - zero log...
> + - scan filesystem freespace and inode maps...
> + - found root inode chunk
> +Phase 3 - for each AG...
> + - scan (but don't clear) agi unlinked lists...
> + - process known inodes and perform inode discovery...
> + - process newly discovered inodes...
> +Phase 4 - check for duplicate blocks...
> + - setting up duplicate extent list...
> + - check for inodes claiming duplicate blocks...
> +No modify flag set, skipping phase 5
> +Phase 6 - check inode connectivity...
> + - traversing filesystem ...
> + - traversal finished ...
> + - moving disconnected inodes to lost+found ...
> +Phase 7 - verify link counts...
> +No modify flag set, skipping filesystem flush and exiting.
> +Scrubbing repaired file system
> +Reading from repaired file system
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 01/13] add a "datacsum" group
2026-09-29 1:31 ` Darrick J. Wong
@ 2026-10-05 13:17 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:17 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs, linux-btrfs
On Mon, Sep 28, 2026 at 06:31:21PM -0700, Darrick J. Wong wrote:
> On Thu, Sep 24, 2026 at 12:07:42PM +0200, Christoph Hellwig wrote:
> > Add a group for test exercising data checksum functionality.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> > doc/group-names.txt | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/doc/group-names.txt b/doc/group-names.txt
> > index ef6b8f51cf87..101c72688c02 100644
> > --- a/doc/group-names.txt
> > +++ b/doc/group-names.txt
> > @@ -34,6 +34,7 @@ dangerous dangerous test that can crash the system
> > dangerous_fuzzers fuzzers that can crash your computer
> > dangerous_selftest selftests that crash/hang
> > data data loss checkers
> > +datacsum data checksumming
>
> Seems like a reasonable addition to me. That said ... I bet at least
> btrfs/282 is a data checksum test that's incorrectly in the (metadata)
> scrub group.
I didn't really add any existing btrfs tests, but there's probably
a few. Maybe the btrfs maintainers can help to populate the list?
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable
2026-09-29 1:32 ` Darrick J. Wong
@ 2026-10-05 13:18 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:18 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:32:38PM -0700, Darrick J. Wong wrote:
> On Thu, Sep 24, 2026 at 12:07:43PM +0200, Christoph Hellwig wrote:
> > Add a new SCRATCH_MKFS_OPTIONS variable, which contains options that are
> > only applied to the actualy scratch device, but not to various other
> > devices like scsi_debug or loop devices created by various test.
> >
> > This is important to support mkfs options that do not work on arbitrary
> > devices, like the extended LBA based data checksum support.
>
> Er... what is "extended LBA based data checskum support"? T10PI?
NVMe support non-PI metadata. I had an implementation to support
for XFS data and RT volumes, but it ran into too many issue. None
unfixable, but given that there is basically no hardware that supports
those but not PI I'm not spending more effort on it.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper
2026-09-29 1:38 ` Darrick J. Wong
@ 2026-10-05 13:20 ` Christoph Hellwig
2026-10-05 14:48 ` Darrick J. Wong
0 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:20 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:38:50PM -0700, Darrick J. Wong wrote:
> Any chance we could export file data checksum type via statx or
> somewhere?
I think Christian would hate that. But maybe fsxattrs?
Note that the io_uring support when I get around it will implement
FS_IOC_GETLBMD_CAP, which also has this information, although in a
somewhat convoluted way.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 06/13] xfs/2301: test lazy bounce buffering mode
2026-09-29 1:42 ` Darrick J. Wong
@ 2026-10-05 13:21 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:21 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:42:04PM -0700, Darrick J. Wong wrote:
> > +# Run fsx with error injection for re-retries with bounce buffers, simulating
>
> Aren't these just retries?
Yeah.
> > +
> > +_test_inject_error bounce_reread 100
>
> Were it not for this I'd say this should be a generic test. But I guess
> generic/091 tests the no-bounce code paths just fine, right?
Yes. If other file systems implement lazy boune we could move it
to common with a helper to check for the support, but without that
there is no point in running this test.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 07/13] xfs/2302: add a basic data checksum test
2026-09-29 1:48 ` Darrick J. Wong
@ 2026-10-05 13:22 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:22 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:48:34PM -0700, Darrick J. Wong wrote:
> > +_require_test
> > +_require_loop
> > +_require_zloop
> > +# hack to only run for block based file systems
> > +_require_block_device $SCRATCH_DEV
>
> What XFS filesystem isn't block-based?
None that I know of, not even the magic cluster slop :)
I guess this came from whatever generic test I started with.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement
2026-09-29 1:54 ` Darrick J. Wong
@ 2026-10-05 13:23 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:23 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:54:39PM -0700, Darrick J. Wong wrote:
> > +ls -i $backing_file1 $backing_file2 >> $seqres.full
>
> Heh, this is an amusing way to induce a data checksum verification
> failure -- switching the zone backing files. :) Given that one of the
> previous tests directly writes to the rt dev I think this one is less
> important, but I guess that's one way to simulate an evil-maid device.
Silent misplacement was a fairly common error in early SSDs, so this
seems useful to test. Note that this would not be caught by simple
checksums in extended LBAs without the reftag in T10 PI.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-09-29 1:56 ` Darrick J. Wong
@ 2026-10-05 13:25 ` Christoph Hellwig
2026-10-05 14:51 ` Darrick J. Wong
0 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:25 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:56:45PM -0700, Darrick J. Wong wrote:
> > + $XFS_SCRUB_PROG -x $SCRATCH_MNT >> $seqres.full 2>&1
>
> I think we should just change generic/388 to run xfs_scrub after
> recovery, and add -x if data checksums are enabled? That /would/ have
> the effect of catching recovery errors (or scrub bugs) earlier.
My idea was to key it off XFS_VERIFY_FILE_DATA. But yes, generic
is probably better if no one screams.
> Though I wonder how much that reduces the number of loop iterations over
> a given SOAK_DURATION?
Good question. Maybe adjust that if XFS_VERIFY_FILE_DATA is set?
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 10/13] xfs/2305: version of generic/475 that run xfs_scrub -x for each iteration
2026-09-29 1:57 ` Darrick J. Wong
@ 2026-10-05 13:25 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:25 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 06:57:29PM -0700, Darrick J. Wong wrote:
> On Thu, Sep 24, 2026 at 12:07:51PM +0200, Christoph Hellwig wrote:
> > To check both the metadata integrity and file system checksums after
> > log replay.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> > tests/xfs/2305 | 75 ++++++++++++++++++++++++++++++++++++++++++++++
> > tests/xfs/2305.out | 2 ++
> > 2 files changed, 77 insertions(+)
> > create mode 100755 tests/xfs/2305
> > create mode 100644 tests/xfs/2305.out
> >
> > diff --git a/tests/xfs/2305 b/tests/xfs/2305
> > new file mode 100755
> > index 000000000000..277f81c13887
> > --- /dev/null
> > +++ b/tests/xfs/2305
> > @@ -0,0 +1,75 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
> > +#
> > +# FS QA Test No. 2305
> > +#
> > +# Copied from generic/475, with added xfs_scrub -x calls for each iteration to
> > +# verify the integrity of all file data and metadata.
>
> Same questions that I had for xfs/2304. :D
Same answer / ramblings here :)
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options
2026-09-29 1:59 ` Darrick J. Wong
@ 2026-10-05 13:26 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:26 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
Yeah, we're not in a rush and I want to see the valid ones pass the
sb buf verifier.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair
2026-09-29 2:03 ` Darrick J. Wong
@ 2026-10-05 13:27 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 07:03:57PM -0700, Darrick J. Wong wrote:
> On Thu, Sep 24, 2026 at 12:07:54PM +0200, Christoph Hellwig wrote:
> > Plus handling of corrupted csum files in the kernel as a side effect.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> > tests/xfs/2308 | 47 ++++++++++++++++++++++++++++++++++++++++++++++
> > tests/xfs/2308.out | 4 ++++
> > 2 files changed, 51 insertions(+)
> > create mode 100755 tests/xfs/2308
> > create mode 100644 tests/xfs/2308.out
> >
> > diff --git a/tests/xfs/2308 b/tests/xfs/2308
> > new file mode 100755
> > index 000000000000..5c4f647ced7a
> > --- /dev/null
> > +++ b/tests/xfs/2308
> > @@ -0,0 +1,47 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +# Copyright (c) 2026 Christoph Hellwig.
> > +#
> > +# FS QA Test No. 2308
> > +#
> > +# Corrupt rtcsum and check that scrub and different kinds of reads catch them.
>
> Heh ok here's the real meat :D
>
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto quick zone datacsum scrub
> > +
> > +. ./common/filter
> > +. ./common/fuzzy
> > +
> > +_require_scratch_nocheck
> > +
> > +_scratch_mkfs >> $seqres.full 2>&1
> > +_scratch_mount
> > +_require_xfs_data_csum $TEST_DIR
> > +
> > +cat /bin/sh > $SCRATCH_MNT/sh
> > +sync $SCRATCH_MNT
> > +
> > +rg=`xfs_bmap -v $SCRATCH_MNT/sh | _filter_bmap_gno`
> > +rg="${rg// /}"
> > +
> > +_scratch_unmount
> > +
> > +$XFS_DB_PROG -x $SCRATCH_DEV \
> > + -c "path -m /rtgroups/$rg.csum" \
> > + -c 'dblock 0' \
> > + -c 'write csums[0] 4266'
> > +
> > +_scratch_mount
> > +$XFS_SCRUB_PROG -x -a 1 $SCRATCH_MNT >> $seqres.full 2>&1
> > +if [ $? -eq 0 ]; then
> > + _fail "scrub did not find corruption"
> > +fi
> > +
> > +# Test buffered I/O
> > +$XFS_IO_PROG -c 'pread 0 64k' $SCRATCH_MNT/sh
> > +
> > +# Test direct I/O
> > +$XFS_IO_PROG -d -c 'pread 0 64k' $SCRATCH_MNT/sh
>
> Should this also run xfs_repair to make sure that it also notices the
> checksum validation errors?
xfs_repair does not validate checksums. That would mean make it run
forever and is generally not helpful if people have corrupted file systems..
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums
2026-09-29 2:05 ` Darrick J. Wong
@ 2026-10-05 13:27 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 13:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Sep 28, 2026 at 07:05:09PM -0700, Darrick J. Wong wrote:
> Want to try something wild and less obvious like ... shrinking one of
> the extent maps so that there's a sparse hole in the rtcsum file?
Sure, if you provide the xfs_db magic to inject it :)
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper
2026-10-05 13:20 ` Christoph Hellwig
@ 2026-10-05 14:48 ` Darrick J. Wong
2026-10-05 14:55 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-10-05 14:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Mon, Oct 05, 2026 at 03:20:29PM +0200, Christoph Hellwig wrote:
> On Mon, Sep 28, 2026 at 06:38:50PM -0700, Darrick J. Wong wrote:
> > Any chance we could export file data checksum type via statx or
> > somewhere?
>
> I think Christian would hate that. But maybe fsxattrs?
> Note that the io_uring support when I get around it will implement
> FS_IOC_GETLBMD_CAP, which also has this information, although in a
> somewhat convoluted way.
Oh wow, a new ioctl. Having not tried to do anything with it, it looks
promising. Would it be useful for a filesystem with software checksums
to advertise something like this:
struct logical_block_metadata_cap foo = {
.lbmd_flags = LBMD_FS_CSUM_CRC32C, /* doesn't yet exist */
.lbmd_interval = i_blocksize(...),
.lbmd_size = 4,
};
Even though userspace cannot (yet) access the per-fsblock crc32c data?
Also, if the fs supports per-fsblock checksums and the storage supports
per-LBA PI, which gets advertised?
--D
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-10-05 13:25 ` Christoph Hellwig
@ 2026-10-05 14:51 ` Darrick J. Wong
2026-10-05 14:56 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-10-05 14:51 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Mon, Oct 05, 2026 at 03:25:22PM +0200, Christoph Hellwig wrote:
> On Mon, Sep 28, 2026 at 06:56:45PM -0700, Darrick J. Wong wrote:
> > > + $XFS_SCRUB_PROG -x $SCRATCH_MNT >> $seqres.full 2>&1
> >
> > I think we should just change generic/388 to run xfs_scrub after
> > recovery, and add -x if data checksums are enabled? That /would/ have
> > the effect of catching recovery errors (or scrub bugs) earlier.
>
> My idea was to key it off XFS_VERIFY_FILE_DATA. But yes, generic
> is probably better if no one screams.
>
> > Though I wonder how much that reduces the number of loop iterations over
> > a given SOAK_DURATION?
>
> Good question. Maybe adjust that if XFS_VERIFY_FILE_DATA is set?
Yes.
I'm ok with g388 running more slowly if it'll catch data checksum bugs
and whatnot. I'm a little surprised that it doesn't already run
_check_filesystems every loop iteration.
--D
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper
2026-10-05 14:48 ` Darrick J. Wong
@ 2026-10-05 14:55 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 14:55 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Oct 05, 2026 at 07:48:56AM -0700, Darrick J. Wong wrote:
> Oh wow, a new ioctl. Having not tried to do anything with it, it looks
> promising. Would it be useful for a filesystem with software checksums
> to advertise something like this:
>
> struct logical_block_metadata_cap foo = {
> .lbmd_flags = LBMD_FS_CSUM_CRC32C, /* doesn't yet exist */
> .lbmd_interval = i_blocksize(...),
> .lbmd_size = 4,
> };
Yes, see the patch below for that below, It might or might not apply to
the current series, but it should give you the idea.
> Even though userspace cannot (yet) access the per-fsblock crc32c data?
Well, I want that to be possible eventually. I even have working code,
but it has too many layering violations to publish it at the moment.
> Also, if the fs supports per-fsblock checksums and the storage supports
> per-LBA PI, which gets advertised?
Wherever the file systems wants to store it because it intercepts both
the ioctl and the io_uring with metadata ops. So probably is it's own
location. I should probably add a test for xfs crcs on top of PI to
make sure nothing breaks this..
---
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 96ca3e480cb9..6aa3e7f78eb5 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -46,6 +46,7 @@
#include "xfs_verify_media.h"
#include "xfs_zone_priv.h"
#include "xfs_zone_alloc.h"
+#include "xfs_rtcsum.h"
#include <linux/mount.h>
#include <linux/fileattr.h>
@@ -1200,6 +1201,36 @@ xfs_ioctl_fs_counts(
return 0;
}
+static int
+xfs_ioc_getlbmd_cap(
+ struct xfs_inode *ip,
+ unsigned int cmd,
+ struct logical_block_metadata_cap __user *argp)
+{
+ struct xfs_mount *mp = ip->i_mount;
+ size_t usize = _IOC_SIZE(cmd);
+ struct logical_block_metadata_cap lbm = {};
+
+ if (xfs_is_rtcsum_inode(ip)) {
+ lbm.lbmd_flags |= LBMD_PI_CAP_INTEGRITY;
+ lbm.lbmd_interval = mp->m_sb.sb_blocksize;
+ lbm.lbmd_pi_size = 1U << mp->m_rtcsum_shift;
+ lbm.lbmd_size = lbm.lbmd_pi_size;
+ switch (mp->m_sb.sb_rtcsum) {
+ case XFS_CSUM_TYPE_CRC32C:
+ lbm.lbmd_guard_tag_type = LBMD_PI_CSUM_CRC32C;
+ break;
+ case XFS_CSUM_TYPE_CRC64:
+ lbm.lbmd_guard_tag_type = LBMD_PI_CSUM_CRC64_NVME;
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ }
+ }
+
+ return copy_struct_to_user(argp, usize, &lbm, sizeof(lbm), NULL);
+}
+
/*
* These long-unused ioctls were removed from the official ioctl API in 5.17,
* but retain these definitions so that we can log warnings about them.
@@ -1467,6 +1498,9 @@ xfs_file_ioctl(
return xfs_ioc_verify_media(filp, arg);
default:
+ if (extensible_ioctl_valid(cmd, FS_IOC_GETLBMD_CAP,
+ LBMD_SIZE_VER0))
+ return xfs_ioc_getlbmd_cap(ip, cmd, arg);
return -ENOTTY;
}
}
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-10-05 14:51 ` Darrick J. Wong
@ 2026-10-05 14:56 ` Christoph Hellwig
2026-10-05 15:20 ` Darrick J. Wong
0 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-05 14:56 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Oct 05, 2026 at 07:51:23AM -0700, Darrick J. Wong wrote:
> I'm ok with g388 running more slowly if it'll catch data checksum bugs
> and whatnot. I'm a little surprised that it doesn't already run
> _check_filesystems every loop iteration.
Maybe we should patch that in first, and then XFS_VERIFY_FILE_DATA
magically does the right thing?
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-10-05 14:56 ` Christoph Hellwig
@ 2026-10-05 15:20 ` Darrick J. Wong
2026-10-07 13:42 ` Christoph Hellwig
0 siblings, 1 reply; 45+ messages in thread
From: Darrick J. Wong @ 2026-10-05 15:20 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Mon, Oct 05, 2026 at 04:56:15PM +0200, Christoph Hellwig wrote:
> On Mon, Oct 05, 2026 at 07:51:23AM -0700, Darrick J. Wong wrote:
> > I'm ok with g388 running more slowly if it'll catch data checksum bugs
> > and whatnot. I'm a little surprised that it doesn't already run
> > _check_filesystems every loop iteration.
>
> Maybe we should patch that in first, and then XFS_VERIFY_FILE_DATA
> magically does the right thing?
I was about to repy "Sounds like a good idea for g388 and probably g475
as well" but then I remembered something from my notes. The two tests
run without _check_filesystems on the assumption that accidental
corruptions will multiply until either (a) the cycle_mount will fail or
(b) the post-test _check_filesystems will have a lot to complain about.
Doing the check every loop cycle reduces the number of log recoveries
that we can do in a given SOAK_DURATION by a significant amount.
What if we ran $XFS_IO_PROG -c verifymedia once per loop if
XFS_VERIFY_FILE_DATA? That would avoid a full xfs_{repair,scrub} run
(+ extra mount cycle) but catch problems earlier.
--D
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-10-05 15:20 ` Darrick J. Wong
@ 2026-10-07 13:42 ` Christoph Hellwig
2026-10-07 15:19 ` Darrick J. Wong
0 siblings, 1 reply; 45+ messages in thread
From: Christoph Hellwig @ 2026-10-07 13:42 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Mon, Oct 05, 2026 at 08:20:57AM -0700, Darrick J. Wong wrote:
> I was about to repy "Sounds like a good idea for g388 and probably g475
> as well" but then I remembered something from my notes. The two tests
> run without _check_filesystems on the assumption that accidental
> corruptions will multiply until either (a) the cycle_mount will fail or
> (b) the post-test _check_filesystems will have a lot to complain about.
> Doing the check every loop cycle reduces the number of log recoveries
> that we can do in a given SOAK_DURATION by a significant amount.
>
> What if we ran $XFS_IO_PROG -c verifymedia once per loop if
> XFS_VERIFY_FILE_DATA? That would avoid a full xfs_{repair,scrub} run
> (+ extra mount cycle) but catch problems earlier.
$XFS_IO_PROG -c verifymedia would also verify potentially unwritten
areas. We'd still need the full xfs_scrub space map scan at least,
but I can look into an option to only do media verification in
scrub, which also sounds useful outside of just xfstests.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration
2026-10-07 13:42 ` Christoph Hellwig
@ 2026-10-07 15:19 ` Darrick J. Wong
0 siblings, 0 replies; 45+ messages in thread
From: Darrick J. Wong @ 2026-10-07 15:19 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Wed, Oct 07, 2026 at 03:42:02PM +0200, Christoph Hellwig wrote:
> On Mon, Oct 05, 2026 at 08:20:57AM -0700, Darrick J. Wong wrote:
> > I was about to repy "Sounds like a good idea for g388 and probably g475
> > as well" but then I remembered something from my notes. The two tests
> > run without _check_filesystems on the assumption that accidental
> > corruptions will multiply until either (a) the cycle_mount will fail or
> > (b) the post-test _check_filesystems will have a lot to complain about.
> > Doing the check every loop cycle reduces the number of log recoveries
> > that we can do in a given SOAK_DURATION by a significant amount.
> >
> > What if we ran $XFS_IO_PROG -c verifymedia once per loop if
> > XFS_VERIFY_FILE_DATA? That would avoid a full xfs_{repair,scrub} run
> > (+ extra mount cycle) but catch problems earlier.
>
> $XFS_IO_PROG -c verifymedia would also verify potentially unwritten
> areas. We'd still need the full xfs_scrub space map scan at least,
> but I can look into an option to only do media verification in
> scrub, which also sounds useful outside of just xfstests.
XFS_SCRUB_PHASE=6 xfs_scrub -d -x $SCRATCH_MNT
--D
^ permalink raw reply [flat|nested] 45+ messages in thread
end of thread, other threads:[~2026-10-07 15:19 UTC | newest]
Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 10:07 xfstests support for RT data checksums Christoph Hellwig
2026-09-24 10:07 ` [PATCH 01/13] add a "datacsum" group Christoph Hellwig
2026-09-29 1:31 ` Darrick J. Wong
2026-10-05 13:17 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable Christoph Hellwig
2026-09-29 1:32 ` Darrick J. Wong
2026-10-05 13:18 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable Christoph Hellwig
2026-09-29 1:34 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 04/13] xfs/206: filter out csum information from mkfs output Christoph Hellwig
2026-09-29 1:34 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 05/13] xfs: add a _require_xfs_data_csum helper Christoph Hellwig
2026-09-29 1:38 ` Darrick J. Wong
2026-10-05 13:20 ` Christoph Hellwig
2026-10-05 14:48 ` Darrick J. Wong
2026-10-05 14:55 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 06/13] xfs/2301: test lazy bounce buffering mode Christoph Hellwig
2026-09-29 1:42 ` Darrick J. Wong
2026-10-05 13:21 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 07/13] xfs/2302: add a basic data checksum test Christoph Hellwig
2026-09-29 1:48 ` Darrick J. Wong
2026-10-05 13:22 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement Christoph Hellwig
2026-09-29 1:54 ` Darrick J. Wong
2026-10-05 13:23 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration Christoph Hellwig
2026-09-29 1:56 ` Darrick J. Wong
2026-10-05 13:25 ` Christoph Hellwig
2026-10-05 14:51 ` Darrick J. Wong
2026-10-05 14:56 ` Christoph Hellwig
2026-10-05 15:20 ` Darrick J. Wong
2026-10-07 13:42 ` Christoph Hellwig
2026-10-07 15:19 ` Darrick J. Wong
2026-09-24 10:07 ` [PATCH 10/13] xfs/2305: version of generic/475 " Christoph Hellwig
2026-09-29 1:57 ` Darrick J. Wong
2026-10-05 13:25 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options Christoph Hellwig
2026-09-29 1:59 ` Darrick J. Wong
2026-10-05 13:26 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums Christoph Hellwig
2026-09-29 2:05 ` Darrick J. Wong
2026-10-05 13:27 ` Christoph Hellwig
2026-09-24 10:07 ` [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair Christoph Hellwig
2026-09-29 2:03 ` Darrick J. Wong
2026-10-05 13:27 ` Christoph Hellwig
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.