Skip to contentSkip to conversation

xfs: don't run tests that require v4 file systems when not supported

PATCH In review Christoph Hellwig 3 participants 5 messages Mar 28, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: don't run tests that require v4 file systems when not supported

Add a _require_xfs_nocrc helper that checks that we can mkfs and mount a crc=0 file systems before running tests that rely on it to avoid failures on kernels with CONFIG_XFS_SUPPORT_V4 disabled.

---
 common/xfs    | 10 ++++++++++
 tests/xfs/002 |  4 +---
 tests/xfs/045 |  1 +
 tests/xfs/095 |  1 +
 tests/xfs/132 |  3 ++-
 tests/xfs/148 |  2 +-
 tests/xfs/158 |  1 +
 tests/xfs/160 |  1 +
 tests/xfs/194 |  2 ++
 tests/xfs/199 |  1 +
 tests/xfs/263 |  1 +
 tests/xfs/513 |  1 +
 tests/xfs/522 |  1 +
 tests/xfs/526 |  1 +
 14 files changed, 25 insertions(+), 5 deletions(-)
common/xfs +10 -0
index 65b509691..5da6987b2 100644
@@ -1887,3 +1887,13 @@ _xfs_discard_max_offset_kb()
 	$XFS_IO_PROG -c 'statfs' "$1" | \
 		awk '{g[$1] = $3} END {print (g["geom.bsize"] * g["geom.datablocks"] / 1024)}'
 }
+
+# check if mkfs and the kernel support nocrc (v4) file systems
+_require_xfs_nocrc()
+{
+	_scratch_mkfs_xfs -m crc=0 > /dev/null 2>&1 || \
+		_notrun "v4 file systems not supported"
+	_try_scratch_mount > /dev/null 2>&1 || \
+		_notrun "v4 file systems not supported"
+	_scratch_unmount
+}
tests/xfs/002 +1 -3
index 6c0bb4d04..26d0cd6e4 100755
@@ -23,9 +23,7 @@ _begin_fstest auto quick growfs
 _supported_fs xfs
 _require_scratch_nocheck
 _require_no_large_scratch_dev
-
-# So we can explicitly turn it _off_:
-_require_xfs_mkfs_crc
+_require_xfs_nocrc
 
 _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed"
 
tests/xfs/045 +1 -0
index d8cc9ac29..69531ba71 100755
@@ -22,6 +22,7 @@ _supported_fs xfs
 
 _require_test
 _require_scratch_nocheck
+_require_xfs_nocrc
 
 echo "*** get uuid"
 uuid=`_get_existing_uuid`
tests/xfs/095 +1 -0
index a3891c85e..e7dc3e9f4 100755
@@ -19,6 +19,7 @@ _begin_fstest log v2log auto
 _supported_fs xfs
 _require_scratch
 _require_v2log
+_require_xfs_nocrc
 
 if [ "$(blockdev --getss $SCRATCH_DEV)" != "512" ]; then
 	_notrun "need 512b sector size"
tests/xfs/132 +2 -1
index fa36c09c2..1b8de82f5 100755
@@ -19,12 +19,13 @@ _supported_fs xfs
 
 # we intentionally corrupt the filesystem, so don't check it after the test
 _require_scratch_nocheck
+_require_xfs_nocrc
 
 # on success, we'll get a shutdown filesystem with a really noisy log message
 # due to transaction cancellation.  Hence we don't want to check dmesg here.
 _disable_dmesg_check
 
-_require_xfs_mkfs_crc
+
 _scratch_mkfs -m crc=0 > $seqres.full 2>&1
 
 # The files that EIO in the golden output changes if we have quotas enabled
tests/xfs/148 +1 -1
index 5d0a0bf42..789b8d0a4 100755
@@ -27,7 +27,7 @@ _cleanup()
 _supported_fs xfs
 _require_test
 _require_attrs
-_require_xfs_mkfs_crc
+_require_xfs_nocrc
 _disable_dmesg_check
 
 imgfile=$TEST_DIR/img-$seq
tests/xfs/158 +1 -0
index 4440adf6e..0107fa3d6 100755
@@ -18,6 +18,7 @@ _supported_fs xfs
 _require_scratch_xfs_inobtcount
 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
 _require_xfs_repair_upgrade inobtcount
+_require_xfs_nocrc
 
 # Make sure we can't format a filesystem with inobtcount and not finobt.
 _scratch_mkfs -m crc=1,inobtcount=1,finobt=0 &> $seqres.full && \
tests/xfs/160 +1 -0
index 399fe4bcf..134b38a18 100755
@@ -18,6 +18,7 @@ _supported_fs xfs
 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
 _require_scratch_xfs_bigtime
 _require_xfs_repair_upgrade bigtime
+_require_xfs_nocrc
 
 date --date='Jan 1 00:00:00 UTC 2040' > /dev/null 2>&1 || \
 	_notrun "Userspace does not support dates past 2038."
tests/xfs/194 +2 -0
index 5a1dff5d2..2ef9403bb 100755
@@ -30,6 +30,8 @@ _supported_fs xfs
 # real QA test starts here
 
 _require_scratch
+_require_xfs_nocrc
+
 _scratch_mkfs_xfs >/dev/null 2>&1
 
 # For this test we use block size = 1/8 page size
tests/xfs/199 +1 -0
index 4669f2c3e..f99b04db3 100755
@@ -26,6 +26,7 @@ _cleanup()
 _supported_fs xfs
 
 _require_scratch
+_require_xfs_nocrc
 
 # clear any mkfs options so that we can directly specify the options we need to
 # be able to test the features bitmask behaviour correctly.
tests/xfs/263 +1 -0
index bce4e13f9..99c97a104 100755
@@ -25,6 +25,7 @@ _require_xfs_quota
 # Only test crc and beyond (but we will test with and without the feature)
 _require_xfs_mkfs_crc
 _require_xfs_crc
+_require_xfs_nocrc
 
 function option_string()
 {
tests/xfs/513 +1 -0
index ce2bb3491..42eceeb90 100755
@@ -37,6 +37,7 @@ _fixed_by_kernel_commit 237d7887ae72 \
 _require_test
 _require_loop
 _require_xfs_io_command "falloc"
+_require_xfs_nocrc
 
 LOOP_IMG=$TEST_DIR/$seq.dev
 LOOP_SPARE_IMG=$TEST_DIR/$seq.logdev
tests/xfs/522 +1 -0
index 2475d5844..7db3bb9fc 100755
@@ -27,6 +27,7 @@ _supported_fs xfs
 _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
+_require_xfs_nocrc
 
 def_cfgfile=$TEST_DIR/a
 fsimg=$TEST_DIR/a.img
tests/xfs/526 +1 -0
index 4261e8497..188d0d514 100755
@@ -26,6 +26,7 @@ _supported_fs xfs
 _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
+_require_xfs_nocrc
 
 cfgfile=$TEST_DIR/a
 rm -rf $cfgfile
Signature · 1 line
2.39.2
#1 lore raw
Quoted 6 lines · Christoph Hellwig

Add a _require_xfs_nocrc helper that checks that we can mkfs and mount a crc=0 file systems before running tests that rely on it to avoid failures on kernels with CONFIG_XFS_SUPPORT_V4 disabled.

---

This change makes sense to me, thanks for this update.
By searching "crc=0" in tests/xfs, I got x/096, x/078 and x/300 which are not in this patch. Is there any reason about why they don't need it?

Thanks,
Zorro

Quoted 206 lines
 common/xfs    | 10 ++++++++++
 tests/xfs/002 |  4 +---
 tests/xfs/045 |  1 +
 tests/xfs/095 |  1 +
 tests/xfs/132 |  3 ++-
 tests/xfs/148 |  2 +-
 tests/xfs/158 |  1 +
 tests/xfs/160 |  1 +
 tests/xfs/194 |  2 ++
 tests/xfs/199 |  1 +
 tests/xfs/263 |  1 +
 tests/xfs/513 |  1 +
 tests/xfs/522 |  1 +
 tests/xfs/526 |  1 +
 14 files changed, 25 insertions(+), 5 deletions(-)
common/xfs +10 -0
index 65b509691..5da6987b2 100644
@@ -1887,3 +1887,13 @@ _xfs_discard_max_offset_kb()
 	$XFS_IO_PROG -c 'statfs' "$1" | \
 		awk '{g[$1] = $3} END {print (g["geom.bsize"] * g["geom.datablocks"] / 1024)}'
 }
+
+# check if mkfs and the kernel support nocrc (v4) file systems
+_require_xfs_nocrc()
+{
+	_scratch_mkfs_xfs -m crc=0 > /dev/null 2>&1 || \
+		_notrun "v4 file systems not supported"
+	_try_scratch_mount > /dev/null 2>&1 || \
+		_notrun "v4 file systems not supported"
+	_scratch_unmount
+}
tests/xfs/002 +1 -3
index 6c0bb4d04..26d0cd6e4 100755
@@ -23,9 +23,7 @@ _begin_fstest auto quick growfs
 _supported_fs xfs
 _require_scratch_nocheck
 _require_no_large_scratch_dev
-
-# So we can explicitly turn it _off_:
-_require_xfs_mkfs_crc
+_require_xfs_nocrc
 
 _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed"
 
tests/xfs/045 +1 -0
index d8cc9ac29..69531ba71 100755
@@ -22,6 +22,7 @@ _supported_fs xfs
 
 _require_test
 _require_scratch_nocheck
+_require_xfs_nocrc
 
 echo "*** get uuid"
 uuid=`_get_existing_uuid`
tests/xfs/095 +1 -0
index a3891c85e..e7dc3e9f4 100755
@@ -19,6 +19,7 @@ _begin_fstest log v2log auto
 _supported_fs xfs
 _require_scratch
 _require_v2log
+_require_xfs_nocrc
 
 if [ "$(blockdev --getss $SCRATCH_DEV)" != "512" ]; then
 	_notrun "need 512b sector size"
tests/xfs/132 +2 -1
index fa36c09c2..1b8de82f5 100755
@@ -19,12 +19,13 @@ _supported_fs xfs
 
 # we intentionally corrupt the filesystem, so don't check it after the test
 _require_scratch_nocheck
+_require_xfs_nocrc
 
 # on success, we'll get a shutdown filesystem with a really noisy log message
 # due to transaction cancellation.  Hence we don't want to check dmesg here.
 _disable_dmesg_check
 
-_require_xfs_mkfs_crc
+
 _scratch_mkfs -m crc=0 > $seqres.full 2>&1
 
 # The files that EIO in the golden output changes if we have quotas enabled
tests/xfs/148 +1 -1
index 5d0a0bf42..789b8d0a4 100755
@@ -27,7 +27,7 @@ _cleanup()
 _supported_fs xfs
 _require_test
 _require_attrs
-_require_xfs_mkfs_crc
+_require_xfs_nocrc
 _disable_dmesg_check
 
 imgfile=$TEST_DIR/img-$seq
tests/xfs/158 +1 -0
index 4440adf6e..0107fa3d6 100755
@@ -18,6 +18,7 @@ _supported_fs xfs
 _require_scratch_xfs_inobtcount
 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
 _require_xfs_repair_upgrade inobtcount
+_require_xfs_nocrc
 
 # Make sure we can't format a filesystem with inobtcount and not finobt.
 _scratch_mkfs -m crc=1,inobtcount=1,finobt=0 &> $seqres.full && \
tests/xfs/160 +1 -0
index 399fe4bcf..134b38a18 100755
@@ -18,6 +18,7 @@ _supported_fs xfs
 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
 _require_scratch_xfs_bigtime
 _require_xfs_repair_upgrade bigtime
+_require_xfs_nocrc
 
 date --date='Jan 1 00:00:00 UTC 2040' > /dev/null 2>&1 || \
 	_notrun "Userspace does not support dates past 2038."
tests/xfs/194 +2 -0
index 5a1dff5d2..2ef9403bb 100755
@@ -30,6 +30,8 @@ _supported_fs xfs
 # real QA test starts here
 
 _require_scratch
+_require_xfs_nocrc
+
 _scratch_mkfs_xfs >/dev/null 2>&1
 
 # For this test we use block size = 1/8 page size
tests/xfs/199 +1 -0
index 4669f2c3e..f99b04db3 100755
@@ -26,6 +26,7 @@ _cleanup()
 _supported_fs xfs
 
 _require_scratch
+_require_xfs_nocrc
 
 # clear any mkfs options so that we can directly specify the options we need to
 # be able to test the features bitmask behaviour correctly.
tests/xfs/263 +1 -0
index bce4e13f9..99c97a104 100755
@@ -25,6 +25,7 @@ _require_xfs_quota
 # Only test crc and beyond (but we will test with and without the feature)
 _require_xfs_mkfs_crc
 _require_xfs_crc
+_require_xfs_nocrc
 
 function option_string()
 {
tests/xfs/513 +1 -0
index ce2bb3491..42eceeb90 100755
@@ -37,6 +37,7 @@ _fixed_by_kernel_commit 237d7887ae72 \
 _require_test
 _require_loop
 _require_xfs_io_command "falloc"
+_require_xfs_nocrc
 
 LOOP_IMG=$TEST_DIR/$seq.dev
 LOOP_SPARE_IMG=$TEST_DIR/$seq.logdev
tests/xfs/522 +1 -0
index 2475d5844..7db3bb9fc 100755
@@ -27,6 +27,7 @@ _supported_fs xfs
 _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
+_require_xfs_nocrc
 
 def_cfgfile=$TEST_DIR/a
 fsimg=$TEST_DIR/a.img
tests/xfs/526 +1 -0
index 4261e8497..188d0d514 100755
@@ -26,6 +26,7 @@ _supported_fs xfs
 _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
+_require_xfs_nocrc
 
 cfgfile=$TEST_DIR/a
 rm -rf $cfgfile
Signature · 1 line
2.39.2
#2 lore raw
Quoted 11 lines · Zorro Lang
Quoted 6 lines · Christoph Hellwig

Add a _require_xfs_nocrc helper that checks that we can mkfs and mount a crc=0 file systems before running tests that rely on it to avoid failures on kernels with CONFIG_XFS_SUPPORT_V4 disabled.

---

This change makes sense to me, thanks for this update.
By searching "crc=0" in tests/xfs, I got x/096, x/078 and x/300 which are not in this patch. Is there any reason about why they don't need it?

xfs/078 only forces crc=0 for block size <= 1024 bytes. Would be kinds sad to disable it just to work around this case.

xfs/096 requires an obsolete mkfs without input validation, but I guess adding the doesn't hurt

xfs/300 needs the check, it doesn't run on my test setup because it requires selinux.

#3 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Zorro Lang
Quoted 6 lines · Christoph Hellwig

Add a _require_xfs_nocrc helper that checks that we can mkfs and mount a crc=0 file systems before running tests that rely on it to avoid failures on kernels with CONFIG_XFS_SUPPORT_V4 disabled.

---

Quoted 6 lines
Quoted 3 lines

This change makes sense to me, thanks for this update.
By searching "crc=0" in tests/xfs, I got x/096, x/078 and x/300 which are not in this patch. Is there any reason about why they don't need it?

xfs/078 only forces crc=0 for block size <= 1024 bytes. Would be kinds sad to disable it just to work around this case.

The crc=0 forcing case seems only to activate if XFS_MKFS_HAS_NO_META_SUPPORT is non-empty, which happens only if mkfs.xfs does /not/ support V5 filesystems. Maybe we can drop that case?

Quoted 2 lines

xfs/096 requires an obsolete mkfs without input validation, but I guess adding the doesn't hurt

Why do we even keep this test then? Do we care about xfsprogs 4.5? 4.19^H4 is the oldest LTS kernel...

--D

Quoted 4 lines

xfs/300 needs the check, it doesn't run on my test setup because it requires selinux.

#4 lore raw
Quoted 5 lines · Darrick J. Wong

The crc=0 forcing case seems only to activate if XFS_MKFS_HAS_NO_META_SUPPORT is non-empty, which happens only if mkfs.xfs does /not/ support V5 filesystems. Maybe we can drop that case?

The way I read it is is that it is activate if XFS_MKFS_HAS_NO_META_SUPPORT is emtpy, that is if CRC are supported and it then disables them. But only for < 1024 bytes block sizes, which we don't actually support for crc-enabled file systems.

Maybe just drop the 512 byte block size testing from this patch entirely? And with that the rather oddly named XFS_MKFS_HAS_NO_META_SUPPORT variable can go away as well.

Quoted 5 lines
Quoted 2 lines

xfs/096 requires an obsolete mkfs without input validation, but I guess adding the doesn't hurt

Why do we even keep this test then? Do we care about xfsprogs 4.5? 4.19^H4 is the oldest LTS kernel...

Good point. I'll add a patch to remove it.