Skip to contentSkip to conversation

xfstests support for RT data checksums

PATCH In review Christoph Hellwig 2 participants 45 messages Sep 24 – Oct 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw

PATCH 1/13 add a "datacsum" group

Add a group for test exercising data checksum functionality.

---
 doc/group-names.txt | 1 +
 1 file changed, 1 insertion(+)
doc/group-names.txt +1 -0
index ef6b8f51cf87..101c72688c02 100644
@@ -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
Signature · 1 line
2.53.0
Reviewed-by on v1 1/13
#2 lore raw

Re: [PATCH 01/13] add a "datacsum" group

Quoted 12 lines · Christoph Hellwig

Add a group for test exercising data checksum functionality.

---
 doc/group-names.txt | 1 +
 1 file changed, 1 insertion(+)
doc/group-names.txt +0 -0
index ef6b8f51cf87..101c72688c02 100644

doc/group-names.txt dangerous dangerous test that can crash the system · line 37

Quoted 4 lines
doc/group-names.txt +1 -0
@@ -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.

--D

Quoted 7 lines
doc/group-names.txt +0 -0
 dax			direct access mode for persistent memory files
 db			xfs_db functional tests
 dedupe			FIEDEDUPERANGE ioctl
Signature · 1 line
2.53.0
#3 lore raw

Re: [PATCH 01/13] add a "datacsum" group

Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Christoph Hellwig

Add a group for test exercising data checksum functionality.

---
 doc/group-names.txt | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

doc/group-names.txt dangerous dangerous test that can crash the system · line 37

Quoted 9 lines
doc/group-names.txt +1 -0
index ef6b8f51cf87..101c72688c02 100644
@@ -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?

#4 lore raw

PATCH 2/13 common: add a SCRATCH_MKFS_OPTIONS variable

In reply to Christoph Hellwig

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.

---
 README    | 2 ++
 common/rc | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
README +2 -0
index 8644f163b1ab..cc03f51e1ad3 100644
@@ -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".
common/rc +3 -1
index 3958ac934980..7fc5ff956959 100644
@@ -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=$?
 
Signature · 1 line
2.53.0
Reviewed-by on v1 2/13
#5 lore raw

Re: [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable

Quoted 6 lines · Christoph Hellwig

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

--D

Quoted 43 lines
---
 README    | 2 ++
 common/rc | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
README +2 -0
index 8644f163b1ab..cc03f51e1ad3 100644
@@ -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".
common/rc +3 -1
index 3958ac934980..7fc5ff956959 100644
@@ -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=$?
 
Signature · 1 line
2.53.0
#6 lore raw

Re: [PATCH 02/13] common: add a SCRATCH_MKFS_OPTIONS variable

Quoted 9 lines · Darrick J. Wong
Quoted 6 lines · Christoph Hellwig

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.

#7 lore raw

PATCH 3/13 xfs: add a XFS_VERIFY_FILE_DATA variable

In reply to Christoph Hellwig

Add an option to run the end of testt xfs_scrub call using the -x option to also check file data validity.

---
 README     | 3 +++
 common/xfs | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
README +3 -0
index cc03f51e1ad3..0ce7d4463354 100644
@@ -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:
common/xfs +7 -1
index 98981e624dda..8254e48603af 100644
@@ -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
Signature · 1 line
2.53.0
Reviewed-by on v1 3/13
#8 lore raw

Re: [PATCH 03/13] xfs: add a XFS_VERIFY_FILE_DATA variable

Quoted 1 line · Christoph Hellwig

Add an option to run the end of testt xfs_scrub call using the -x

test

Quoted 27 lines

option to also check file data validity.

---
 README     | 3 +++
 common/xfs | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
README +3 -0
index cc03f51e1ad3..0ce7d4463354 100644
@@ -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:
common/xfs +0 -0
index 98981e624dda..8254e48603af 100644

common/xfs _check_xfs_filesystem() · line 882

Quoted 8 lines
common/xfs +5 -0
@@ -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.

--D

Quoted 17 lines
common/xfs +2 -1
+
 		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
Signature · 1 line
2.53.0
#9 lore raw

PATCH 4/13 xfs/206: filter out csum information from mkfs output

In reply to Christoph Hellwig

To make the test work with csum-enabled mkfs.

---
 tests/xfs/206 | 1 +
 1 file changed, 1 insertion(+)
tests/xfs/206 +1 -0
index a515c6c8838c..f5e0b1404732 100755
@@ -67,6 +67,7 @@ mkfs_filter()
 	    -e 's/, parent=[01]//' \
 	    -e '/rgcount=/d' \
 	    -e '/zoned=/d' \
+	    -e '/csum=/d' \
 	    -e "/^Default configuration/d"
 }
 
Signature · 1 line
2.53.0
Reviewed-by on v1 4/13
#10 lore raw

Re: [PATCH 04/13] xfs/206: filter out csum information from mkfs output

Quoted 3 lines · Christoph Hellwig

To make the test work with csum-enabled mkfs.

Ugh, I hate this test. But it makes sense.

--D

Quoted 20 lines
---
 tests/xfs/206 | 1 +
 1 file changed, 1 insertion(+)
tests/xfs/206 +1 -0
index a515c6c8838c..f5e0b1404732 100755
@@ -67,6 +67,7 @@ mkfs_filter()
 	    -e 's/, parent=[01]//' \
 	    -e '/rgcount=/d' \
 	    -e '/zoned=/d' \
+	    -e '/csum=/d' \
 	    -e "/^Default configuration/d"
 }
 
Signature · 1 line
2.53.0
#11 lore raw

PATCH 5/13 xfs: add a _require_xfs_data_csum helper

In reply to Christoph Hellwig

Add a helper to check if a given mountpoint supports (RT) data checksums on XFS.

---
 common/xfs | 13 +++++++++++++
 1 file changed, 13 insertions(+)
common/xfs +13 -0
index 8254e48603af..e9f6877c98cd 100644
@@ -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
+}
Signature · 1 line
2.53.0
Reviewed-by on v1 5/13
#12 lore raw

Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper

Quoted 17 lines · Christoph Hellwig

Add a helper to check if a given mountpoint supports (RT) data checksums on XFS.

---
 common/xfs | 13 +++++++++++++
 1 file changed, 13 insertions(+)
common/xfs +1 -0
index 8254e48603af..e9f6877c98cd 100644
@@ -2448,3 +2448,16 @@ _require_xfs_healer()
 
 	_scratch_mkfs_xfs_supported "$arg" concurrency=0
 }
+

common/xfs _require_xfs_healer() · line 2461

Quoted 10 lines
common/xfs +10 -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,

--D

Quoted 6 lines
common/xfs +2 -0
+	fi
+}
Signature · 1 line
2.53.0
#13 lore raw

Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper

Quoted 2 lines · Darrick J. Wong

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.

#14 lore raw

Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper

Quoted 8 lines · Christoph Hellwig
Quoted 2 lines · Darrick J. Wong

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

#15 lore raw

Re: [PATCH 05/13] xfs: add a _require_xfs_data_csum helper

Quoted 9 lines · Darrick J. Wong

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.

Quoted 1 line

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.

Quoted 2 lines

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..

---

fs/xfs/xfs_ioctl.c +34 -0
index 96ca3e480cb9..6aa3e7f78eb5 100644
@@ -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;
 	}
 }
#16 lore raw

PATCH 6/13 xfs/2301: test lazy bounce buffering mode

In reply to Christoph Hellwig

Run fsx (based on generic/091) while injecting lazy bounce buffer retries for reads.

---
 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
tests/xfs/2301 new file +43 -0
new file mode 100755
index 000000000000..605510c6dbc8
@@ -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
tests/xfs/2301.out new file +13 -0
new file mode 100644
index 000000000000..221a3185970c
@@ -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
Signature · 1 line
2.53.0
#17 lore raw

Re: [PATCH 06/13] xfs/2301: test lazy bounce buffering mode

Quoted 17 lines · Christoph Hellwig

Run fsx (based on generic/091) while injecting lazy bounce buffer retries for reads.

---
 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
tests/xfs/2301 new file +0 -0
new file mode 100755
index 000000000000..605510c6dbc8

tests/xfs/2301 line 8

Quoted 8 lines
tests/xfs/2301 new file +8 -0
@@ -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?

Quoted 6 lines
tests/xfs/2301 new file +6 -0
+# users modifying the in-flight data buffer.
+#
+. ./common/preamble
+_begin_fstest rw auto quick datacsum
+
+. ./common/filter

tests/xfs/2301 line 24

Quoted 10 lines
tests/xfs/2301 new file +10 -0
+. ./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?

Quoted 8 lines
tests/xfs/2301 new file +8 -0
+# 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

tests/xfs/2301 line 43

Quoted 10 lines
tests/xfs/2301 new file +10 -0
+
+# 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

Quoted 23 lines
tests/xfs/2301.out new file +13 -0
new file mode 100644
index 000000000000..221a3185970c
@@ -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
Signature · 1 line
2.53.0
#18 lore raw

Re: [PATCH 06/13] xfs/2301: test lazy bounce buffering mode

Quoted 3 lines · Darrick J. Wong
Quoted 1 line

+# Run fsx with error injection for re-retries with bounce buffers, simulating

Aren't these just retries?

Yeah.

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+_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.

#19 lore raw

PATCH 7/13 xfs/2302: add a basic data checksum test

In reply to Christoph Hellwig

Setup a zoned loop device, mess up the data and make sure both buffered and direct I/O catch it.

---
 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
tests/xfs/2302 new file +96 -0
new file mode 100755
index 000000000000..d0ef9abc87b0
@@ -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
tests/xfs/2302.out new file +25 -0
new file mode 100644
index 000000000000..5e2108b5cec0
@@ -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
Signature · 1 line
2.53.0
#20 lore raw

Re: [PATCH 07/13] xfs/2302: add a basic data checksum test

Quoted 41 lines · Christoph Hellwig

Setup a zoned loop device, mess up the data and make sure both buffered and direct I/O catch it.

---
 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
tests/xfs/2302 new file +24 -0
new file mode 100755
index 000000000000..d0ef9abc87b0
@@ -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
+}
+

tests/xfs/2302 line 34

Quoted 10 lines
tests/xfs/2302 new file +10 -0
+_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?

Quoted 27 lines
tests/xfs/2302 new file +27 -0
+
+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
+

tests/xfs/2302 line 71

Quoted 10 lines
tests/xfs/2302 new file +10 -0
+	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

Quoted 31 lines
tests/xfs/2302 new file +25 -0
+
+	# 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
tests/xfs/2302.out new file +0 -0
new file mode 100644
index 000000000000..5e2108b5cec0

tests/xfs/2302.out line 7

Quoted 7 lines
tests/xfs/2302.out new file +7 -0
@@ -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

Quoted 22 lines
tests/xfs/2302.out new file +18 -0
+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
Signature · 1 line
2.53.0
#21 lore raw

Re: [PATCH 07/13] xfs/2302: add a basic data checksum test

Quoted 7 lines · Darrick J. Wong

tests/xfs/2302 line 34

Quoted 5 lines
tests/xfs/2302 new file +5 -0
+_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.

#22 lore raw

PATCH 8/13 xfs/2303: test that data checksums detect data misplacement

In reply to Christoph Hellwig

Test that data checksums detect data corruption due to misplacement by changing the backing files for two zones using the zloop driver.

---
 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
tests/xfs/2303 new file +88 -0
new file mode 100755
index 000000000000..7f53fdf94bff
@@ -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
tests/xfs/2303.out new file +5 -0
new file mode 100644
index 000000000000..fca2c4830e3c
@@ -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
Signature · 1 line
2.53.0
#23 lore raw

Re: [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement

Quoted 81 lines · Christoph Hellwig

Test that data checksums detect data corruption due to misplacement by changing the backing files for two zones using the zloop driver.

---
 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
tests/xfs/2303 new file +64 -0
new file mode 100755
index 000000000000..7f53fdf94bff
@@ -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)

tests/xfs/2303 line 74

Quoted 10 lines
tests/xfs/2303 new file +10 -0
+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

Quoted 29 lines
tests/xfs/2303 new file +14 -0
+
+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
tests/xfs/2303.out new file +5 -0
new file mode 100644
index 000000000000..fca2c4830e3c
@@ -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
Signature · 1 line
2.53.0
#24 lore raw

Re: [PATCH 08/13] xfs/2303: test that data checksums detect data misplacement

Quoted 6 lines · Darrick J. Wong
Quoted 1 line

+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.

#25 lore raw

PATCH 9/13 xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

In reply to Christoph Hellwig

To check both the metadata integrity and file system checksums after log replay.

---
 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
tests/xfs/2304 new file +61 -0
new file mode 100755
index 000000000000..ad4f45d79057
@@ -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
tests/xfs/2304.out new file +2 -0
new file mode 100644
index 000000000000..07ee489db9fa
@@ -0,0 +1,2 @@
+QA output created by 2304
+Silence is golden.
Signature · 1 line
2.53.0
#26 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 60 lines · Christoph Hellwig

To check both the metadata integrity and file system checksums after log replay.

---
 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
tests/xfs/2304 new file +43 -0
new file mode 100755
index 000000000000..ad4f45d79057
@@ -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
+

tests/xfs/2304 line 53

Quoted 10 lines
tests/xfs/2304 new file +10 -0
+	# 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

Quoted 20 lines
tests/xfs/2304 new file +8 -0
+	if [ $? -ne 0 ]; then
+		_fail "scrub found errors"
+	fi
+done
+
+# success, all done
+status=0
+exit
tests/xfs/2304.out new file +2 -0
new file mode 100644
index 000000000000..07ee489db9fa
@@ -0,0 +1,2 @@
+QA output created by 2304
+Silence is golden.
Signature · 1 line
2.53.0
#27 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 5 lines · Darrick J. Wong

tests/xfs/2304 line 53

Quoted 1 line
tests/xfs/2304 new file +1 -0
+	$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.

Quoted 2 lines

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?

#28 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong

tests/xfs/2304 line 53

Quoted 1 line
tests/xfs/2304 new file +1 -0
+	$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.

Quoted 7 lines

My idea was to key it off XFS_VERIFY_FILE_DATA. But yes, generic is probably better if no one screams.

Quoted 2 lines

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

#29 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 3 lines · Darrick J. Wong

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?

#30 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Darrick J. Wong

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

#31 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 11 lines · Darrick J. Wong

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.

#32 lore raw

Re: [PATCH 09/13] xfs/2304: version of generic/388 that run xfs_scrub -x for each iteration

Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Darrick J. Wong

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.

Quoted 8 lines
Quoted 3 lines

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

#33 lore raw

PATCH 10/13 xfs/2305: version of generic/475 that run xfs_scrub -x for each iteration

In reply to Christoph Hellwig

To check both the metadata integrity and file system checksums after log replay.

---
 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
tests/xfs/2305 new file +75 -0
new file mode 100755
index 000000000000..277f81c13887
@@ -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
tests/xfs/2305.out new file +2 -0
new file mode 100644
index 000000000000..8265227294ca
@@ -0,0 +1,2 @@
+QA output created by 2305
+Silence is golden.
Signature · 1 line
2.53.0
#34 lore raw

Re: [PATCH 10/13] xfs/2305: version of generic/475 that run xfs_scrub -x for each iteration

Quoted 17 lines · Christoph Hellwig

To check both the metadata integrity and file system checksums after log replay.

---
 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
tests/xfs/2305 new file +0 -0
new file mode 100755
index 000000000000..277f81c13887

tests/xfs/2305 line 8

Quoted 8 lines
tests/xfs/2305 new file +8 -0
@@ -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

Quoted 78 lines
tests/xfs/2305 new file +66 -0
+# 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
tests/xfs/2305.out new file +2 -0
new file mode 100644
index 000000000000..8265227294ca
@@ -0,0 +1,2 @@
+QA output created by 2305
+Silence is golden.
Signature · 1 line
2.53.0
#35 lore raw

Re: [PATCH 10/13] xfs/2305: version of generic/475 that run xfs_scrub -x for each iteration

Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Christoph Hellwig

To check both the metadata integrity and file system checksums after log replay.

---
 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
Quoted 16 lines
Quoted 6 lines
tests/xfs/2305 new file +0 -0
new file mode 100755
index 000000000000..277f81c13887

tests/xfs/2305 line 8

Quoted 8 lines
tests/xfs/2305 new file +8 -0
@@ -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 :)

#36 lore raw

PATCH 11/13 xfs/2306: test mkfs input validation for RT data csum options

In reply to Christoph Hellwig
---
 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
tests/xfs/2306 new file +50 -0
new file mode 100755
index 000000000000..76dac5bb2a69
@@ -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
tests/xfs/2306.out new file +20 -0
new file mode 100644
index 000000000000..5e79103212ad
@@ -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)
Signature · 1 line
2.53.0
#37 lore raw

Re: [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options

Quoted 14 lines · Christoph Hellwig
---
 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
tests/xfs/2306 new file +0 -0
new file mode 100755
index 000000000000..76dac5bb2a69

tests/xfs/2306 line 7

Quoted 7 lines
tests/xfs/2306 new file +7 -0
@@ -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

Quoted 73 lines
tests/xfs/2306 new file +43 -0
+#
+. ./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
tests/xfs/2306.out new file +20 -0
new file mode 100644
index 000000000000..5e79103212ad
@@ -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)
Signature · 1 line
2.53.0
#38 lore raw

Re: [PATCH 11/13] xfs/2306: test mkfs input validation for RT data csum options

Yeah, we're not in a rush and I want to see the valid ones pass the sb buf verifier.

#39 lore raw

PATCH 12/13 xfs/2307: test checksum handling using corrupted checksums

In reply to Christoph Hellwig

Inject errors into the rtcsum files and check that the kernel handles them gracefully and that repair fixes them, rebuilding the checksums if needed.

---
 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
tests/xfs/2307 new file +106 -0
new file mode 100755
index 000000000000..47d5be36623d
@@ -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
tests/xfs/2307.out new file +93 -0

93 lines not on this page · raw message

Signature · 1 line
2.53.0
#40 lore raw

Re: [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums

Quoted 111 lines · Christoph Hellwig

Inject errors into the rtcsum files and check that the kernel handles them gracefully and that repair fixes them, rebuilding the checksums if needed.

---
 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
tests/xfs/2307 new file +93 -0
new file mode 100755
index 000000000000..47d5be36623d
@@ -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

tests/xfs/2307 line 103

Quoted 10 lines
tests/xfs/2307 new file +10 -0
+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

Quoted 106 lines
tests/xfs/2307 new file +3 -0
+
+status=0
+exit
tests/xfs/2307.out new file +93 -0
new file mode 100644
index 000000000000..2016c27ee280
@@ -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
Signature · 1 line
2.53.0
#41 lore raw

Re: [PATCH 12/13] xfs/2307: test checksum handling using corrupted checksums

Quoted 2 lines · Darrick J. Wong

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 :)

#42 lore raw

PATCH 13/13 xfs/2308: test rebuilding of csum files in xfs_repair

In reply to Christoph Hellwig

Plus handling of corrupted csum files in the kernel as a side effect.

---
 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
tests/xfs/2308 new file +47 -0
new file mode 100755
index 000000000000..5c4f647ced7a
@@ -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
tests/xfs/2308.out new file +4 -0
new file mode 100644
index 000000000000..55f6a0c97264
@@ -0,0 +1,4 @@
+QA output created by 2308
+csums[0] = 4266
+pread: Input/output error
+pread: Input/output error
Signature · 1 line
2.53.0
#43 lore raw

Re: [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair

Quoted 16 lines · Christoph Hellwig

Plus handling of corrupted csum files in the kernel as a side effect.

---
 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
tests/xfs/2308 new file +0 -0
new file mode 100755
index 000000000000..5c4f647ced7a

tests/xfs/2308 line 7

Quoted 7 lines
tests/xfs/2308 new file +7 -0
@@ -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

Quoted 27 lines
tests/xfs/2308 new file +27 -0
+#
+. ./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

tests/xfs/2308 line 44

Quoted 10 lines
tests/xfs/2308 new file +10 -0
+$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

Quoted 17 lines
tests/xfs/2308 new file +3 -0
+
+status=0
+exit
tests/xfs/2308.out new file +4 -0
new file mode 100644
index 000000000000..55f6a0c97264
@@ -0,0 +1,4 @@
+QA output created by 2308
+csums[0] = 4266
+pread: Input/output error
+pread: Input/output error
Signature · 1 line
2.53.0
#44 lore raw

Re: [PATCH 13/13] xfs/2308: test rebuilding of csum files in xfs_repair

Quoted 59 lines · Darrick J. Wong
Quoted 16 lines · Christoph Hellwig

Plus handling of corrupted csum files in the kernel as a side effect.

---
 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
tests/xfs/2308 new file +0 -0
new file mode 100755
index 000000000000..5c4f647ced7a

tests/xfs/2308 line 7

Quoted 7 lines
tests/xfs/2308 new file +7 -0
@@ -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

Quoted 32 lines
tests/xfs/2308 new file +32 -0
+#
+. ./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
+
Quoted 8 lines

tests/xfs/2308 line 44

Quoted 5 lines
tests/xfs/2308 new file +5 -0
+# 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..