Skip to contentSkip to conversation

fix kernels without v5 support v2

PATCH In review Christoph Hellwig 2 participants 12 messages Apr 18, 2024

lore
Share & tools
lore
#0 lore raw

Hi all,

this series ensures tests pass on kernels without v5 support. As a side effect it also removes support for historic kernels and xfsprogs without any v5 support, and without mkfs input validation.

Changes since v1:
- dropped the already merged patches
- made xfs/045 work on v5 file systems
- split out a few v4 test cases insted of disabling the tests
- added comments on why some tests are disabled at least for now

#1 lore raw

PATCH 1/5 xfs/045: don't force v4 file systems

xfs_db can change UUIDs on v5 filesystems now, so we don't need the -mcrc=0 in this test.

---
 tests/xfs/045 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tests/xfs/045 +1 -3
index d8cc9ac29..a596635ec 100755
@@ -26,10 +26,8 @@ _require_scratch_nocheck
 echo "*** get uuid"
 uuid=`_get_existing_uuid`
 
-# We can only change the UUID on a v4 filesystem. Revist this when/if UUIDs
-# canbe changed on v5 filesystems.
 echo "*** mkfs"
-if ! _scratch_mkfs_xfs -m crc=0 >$tmp.out 2>&1
+if ! _scratch_mkfs_xfs >$tmp.out 2>&1
 then
     cat $tmp.out
     echo "!!! failed to mkfs on $SCRATCH_DEV"
Signature · 1 line
2.39.2
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] xfs/045: don't force v4 file systems

Quoted 4 lines · Christoph Hellwig

xfs_db can change UUIDs on v5 filesystems now, so we don't need the -mcrc=0 in this test.

Makes sense,

--D

Quoted 24 lines
---
 tests/xfs/045 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tests/xfs/045 +1 -3
index d8cc9ac29..a596635ec 100755
@@ -26,10 +26,8 @@ _require_scratch_nocheck
 echo "*** get uuid"
 uuid=`_get_existing_uuid`
 
-# We can only change the UUID on a v4 filesystem. Revist this when/if UUIDs
-# canbe changed on v5 filesystems.
 echo "*** mkfs"
-if ! _scratch_mkfs_xfs -m crc=0 >$tmp.out 2>&1
+if ! _scratch_mkfs_xfs >$tmp.out 2>&1
 then
     cat $tmp.out
     echo "!!! failed to mkfs on $SCRATCH_DEV"
Signature · 1 line
2.39.2
#3 lore raw

PATCH 2/5 xfs/263: split out the v4 test

In reply to Christoph Hellwig

Move the v4-specific test into a separate test case so that we can still run the tests on a kernel without v4 support.

---
 tests/xfs/096     | 73 ++++++++++++++++++++++++++++++++++++++++
 tests/xfs/096.out | 84 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/263     |  5 ---
 tests/xfs/263.out | 85 -----------------------------------------------
 4 files changed, 157 insertions(+), 90 deletions(-)
 create mode 100755 tests/xfs/096
 create mode 100644 tests/xfs/096.out
tests/xfs/096 new file +73 -0
new file mode 100755
index 000000000..7eff6cb1d
@@ -0,0 +1,73 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 096
+#
+# test xfs_quota state command (XFS v4 version)
+#
+. ./common/preamble
+_begin_fstest auto quick quota
+
+# Import common functions.
+. ./common/filter
+. ./common/quota
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+
+_require_scratch
+_require_xfs_quota
+
+function option_string()
+{
+	VAL=$1
+	# Treat 3 options as a bit field, prjquota|grpquota|usrquota
+	OPT="rw"
+	if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
+	if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
+	if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
+	echo $OPT
+}
+
+filter_quota_state() {
+	sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \
+	    -e '/max warnings:/d' \
+	    -e '/Blocks grace time:/d' \
+	    -e '/Inodes grace time:/d' \
+		| _filter_scratch
+}
+
+filter_quota_state2() {
+	sed -e '/User quota state on/d' \
+	    -e '/ Accounting: /d' \
+	    -e '/ Enforcement: /d' \
+	    -e '/ Inode: /d' \
+	    -e '/Blocks max warnings: /d' \
+	    -e '/Inodes max warnings: /d' \
+		| _filter_scratch
+}
+
+function test_all_state()
+{
+	for I in `seq 0 7`; do
+		OPTIONS=`option_string $I`
+		echo "== Options: $OPTIONS =="
+		# Some combinations won't mount on V4 supers (grp + prj)
+		_qmount_option "$OPTIONS"
+		_try_scratch_mount &>> $seqres.full || continue
+		$XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -g" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -p" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state2
+		_scratch_unmount
+	done
+}
+
+_scratch_mkfs_xfs "-m crc=0 -n ftype=0" >> $seqres.full
+test_all_state
+
+status=0
+exit
tests/xfs/096.out new file +84 -0

84 lines not on this page · raw message

tests/xfs/263 +0 -5
index bd30dab11..54e9355aa 100755
@@ -66,11 +66,6 @@ function test_all_state()
 	done
 }
 
-echo "==== NO CRC ===="
-_scratch_mkfs_xfs "-m crc=0 -n ftype=0" >> $seqres.full
-test_all_state
-
-echo "==== CRC ===="
 _scratch_mkfs_xfs "-m crc=1" >>$seqres.full
 test_all_state
 
tests/xfs/263.out +0 -85

89 lines not on this page · raw message

Signature · 1 line
2.39.2
Reviewed-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] xfs/263: split out the v4 test

Quoted 4 lines · Christoph Hellwig

Move the v4-specific test into a separate test case so that we can still run the tests on a kernel without v4 support.

Awwright!

--D

Quoted 292 lines
---
 tests/xfs/096     | 73 ++++++++++++++++++++++++++++++++++++++++
 tests/xfs/096.out | 84 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/263     |  5 ---
 tests/xfs/263.out | 85 -----------------------------------------------
 4 files changed, 157 insertions(+), 90 deletions(-)
 create mode 100755 tests/xfs/096
 create mode 100644 tests/xfs/096.out
tests/xfs/096 new file +73 -0
new file mode 100755
index 000000000..7eff6cb1d
@@ -0,0 +1,73 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 096
+#
+# test xfs_quota state command (XFS v4 version)
+#
+. ./common/preamble
+_begin_fstest auto quick quota
+
+# Import common functions.
+. ./common/filter
+. ./common/quota
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+
+_require_scratch
+_require_xfs_quota
+
+function option_string()
+{
+	VAL=$1
+	# Treat 3 options as a bit field, prjquota|grpquota|usrquota
+	OPT="rw"
+	if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
+	if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
+	if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
+	echo $OPT
+}
+
+filter_quota_state() {
+	sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \
+	    -e '/max warnings:/d' \
+	    -e '/Blocks grace time:/d' \
+	    -e '/Inodes grace time:/d' \
+		| _filter_scratch
+}
+
+filter_quota_state2() {
+	sed -e '/User quota state on/d' \
+	    -e '/ Accounting: /d' \
+	    -e '/ Enforcement: /d' \
+	    -e '/ Inode: /d' \
+	    -e '/Blocks max warnings: /d' \
+	    -e '/Inodes max warnings: /d' \
+		| _filter_scratch
+}
+
+function test_all_state()
+{
+	for I in `seq 0 7`; do
+		OPTIONS=`option_string $I`
+		echo "== Options: $OPTIONS =="
+		# Some combinations won't mount on V4 supers (grp + prj)
+		_qmount_option "$OPTIONS"
+		_try_scratch_mount &>> $seqres.full || continue
+		$XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -g" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -p" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state2
+		_scratch_unmount
+	done
+}
+
+_scratch_mkfs_xfs "-m crc=0 -n ftype=0" >> $seqres.full
+test_all_state
+
+status=0
+exit
tests/xfs/096.out new file +84 -0
new file mode 100644
index 000000000..1deb7a8c3
@@ -0,0 +1,84 @@
+QA output created by 096
+== Options: rw ==
+== Options: usrquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: grpquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: usrquota,grpquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: prjquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: usrquota,prjquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: grpquota,prjquota,rw ==
+== Options: usrquota,grpquota,prjquota,rw ==
tests/xfs/263 +0 -5
index bd30dab11..54e9355aa 100755
@@ -66,11 +66,6 @@ function test_all_state()
 	done
 }
 
-echo "==== NO CRC ===="
-_scratch_mkfs_xfs "-m crc=0 -n ftype=0" >> $seqres.full
-test_all_state
-
-echo "==== CRC ===="
 _scratch_mkfs_xfs "-m crc=1" >>$seqres.full
 test_all_state
 
tests/xfs/263.out +0 -85
index 531d45de5..64c1a5876 100644
@@ -1,89 +1,4 @@
 QA output created by 263
-==== NO CRC ====
-== Options: rw ==
-== Options: usrquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: grpquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: usrquota,grpquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: prjquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: usrquota,prjquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: grpquota,prjquota,rw ==
-== Options: usrquota,grpquota,prjquota,rw ==
-==== CRC ====
 == Options: rw ==
 == Options: usrquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
Signature · 1 line
2.39.2
#5 lore raw

PATCH 3/5 xfs/512: split out v4 specific tests

In reply to Christoph Hellwig

Split the v4-specific tests into a new xfs/613.

---
 tests/xfs/513     |  13 ---
 tests/xfs/513.out |   9 ---
 tests/xfs/613     | 198 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/613.out |  15 ++++
 4 files changed, 213 insertions(+), 22 deletions(-)
 create mode 100755 tests/xfs/613
 create mode 100644 tests/xfs/613.out
tests/xfs/513 +0 -13
index ce2bb3491..3a85ed429 100755
@@ -193,10 +193,6 @@ do_mkfs -m crc=1
 do_test "" pass "attr2" "true"
 do_test "-o attr2" pass "attr2" "true"
 do_test "-o noattr2" fail
-do_mkfs -m crc=0
-do_test "" pass "attr2" "true"
-do_test "-o attr2" pass "attr2" "true"
-do_test "-o noattr2" pass "attr2" "false"
 
 # Test discard
 do_mkfs
@@ -255,15 +251,6 @@ do_test "-o logbsize=128k" pass "logbsize=128k" "true"
 do_test "-o logbsize=256k" pass "logbsize=256k" "true"
 do_test "-o logbsize=8k" fail
 do_test "-o logbsize=512k" fail
-do_mkfs -m crc=0 -l version=1
-# New kernel (refer to 4f62282a3696 xfs: cleanup xlog_get_iclog_buffer_size)
-# prints "logbsize=N" in /proc/mounts, but old kernel not. So the default
-# 'display' about logbsize can't be expected, disable this test.
-#do_test "" pass "logbsize" "false"
-do_test "-o logbsize=16384" pass "logbsize=16k" "true"
-do_test "-o logbsize=16k" pass "logbsize=16k" "true"
-do_test "-o logbsize=32k" pass "logbsize=32k" "true"
-do_test "-o logbsize=64k" fail
 
 # Test logdev
 do_mkfs
tests/xfs/513.out +0 -9
index eec8155d7..399459071 100644
@@ -13,10 +13,6 @@ FORMAT: -m crc=1
 TEST: "" "pass" "attr2" "true"
 TEST: "-o attr2" "pass" "attr2" "true"
 TEST: "-o noattr2" "fail"
-FORMAT: -m crc=0
-TEST: "" "pass" "attr2" "true"
-TEST: "-o attr2" "pass" "attr2" "true"
-TEST: "-o noattr2" "pass" "attr2" "false"
 FORMAT: 
 TEST: "" "pass" "discard" "false"
 TEST: "-o discard" "pass" "discard" "true"
@@ -51,11 +47,6 @@ TEST: "-o logbsize=128k" "pass" "logbsize=128k" "true"
 TEST: "-o logbsize=256k" "pass" "logbsize=256k" "true"
 TEST: "-o logbsize=8k" "fail"
 TEST: "-o logbsize=512k" "fail"
-FORMAT: -m crc=0 -l version=1
-TEST: "-o logbsize=16384" "pass" "logbsize=16k" "true"
-TEST: "-o logbsize=16k" "pass" "logbsize=16k" "true"
-TEST: "-o logbsize=32k" "pass" "logbsize=32k" "true"
-TEST: "-o logbsize=64k" "fail"
 FORMAT: 
 TEST: "" "pass" "logdev" "false"
 TEST: "-o logdev=LOOP_SPARE_DEV" "fail"
tests/xfs/613 new file +198 -0

198 lines not on this page · raw message

tests/xfs/613.out new file +15 -0
new file mode 100644
index 000000000..1624617ee
@@ -0,0 +1,15 @@
+QA output created by 613
+** create loop device
+** create loop log device
+** create loop mount point
+** start xfs mount testing ...
+FORMAT: -m crc=0
+TEST: "" "pass" "attr2" "true"
+TEST: "-o attr2" "pass" "attr2" "true"
+TEST: "-o noattr2" "pass" "attr2" "false"
+FORMAT: -m crc=0 -l version=1
+TEST: "-o logbsize=16384" "pass" "logbsize=16k" "true"
+TEST: "-o logbsize=16k" "pass" "logbsize=16k" "true"
+TEST: "-o logbsize=32k" "pass" "logbsize=32k" "true"
+TEST: "-o logbsize=64k" "fail"
+** end of testing
Signature · 1 line
2.39.2
Reviewed-by on v1 3/5
#6 lore raw

Re: [PATCH 3/5] xfs/512: split out v4 specific tests

Quoted 8 lines · Christoph Hellwig

Split the v4-specific tests into a new xfs/613.

---
 tests/xfs/513     |  13 ---
 tests/xfs/513.out |   9 ---
 tests/xfs/613     | 198 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/613.out |  15 ++++

Such numerological coincidence!

--D

Quoted 291 lines
 4 files changed, 213 insertions(+), 22 deletions(-)
 create mode 100755 tests/xfs/613
 create mode 100644 tests/xfs/613.out
tests/xfs/513 +0 -13
index ce2bb3491..3a85ed429 100755
@@ -193,10 +193,6 @@ do_mkfs -m crc=1
 do_test "" pass "attr2" "true"
 do_test "-o attr2" pass "attr2" "true"
 do_test "-o noattr2" fail
-do_mkfs -m crc=0
-do_test "" pass "attr2" "true"
-do_test "-o attr2" pass "attr2" "true"
-do_test "-o noattr2" pass "attr2" "false"
 
 # Test discard
 do_mkfs
@@ -255,15 +251,6 @@ do_test "-o logbsize=128k" pass "logbsize=128k" "true"
 do_test "-o logbsize=256k" pass "logbsize=256k" "true"
 do_test "-o logbsize=8k" fail
 do_test "-o logbsize=512k" fail
-do_mkfs -m crc=0 -l version=1
-# New kernel (refer to 4f62282a3696 xfs: cleanup xlog_get_iclog_buffer_size)
-# prints "logbsize=N" in /proc/mounts, but old kernel not. So the default
-# 'display' about logbsize can't be expected, disable this test.
-#do_test "" pass "logbsize" "false"
-do_test "-o logbsize=16384" pass "logbsize=16k" "true"
-do_test "-o logbsize=16k" pass "logbsize=16k" "true"
-do_test "-o logbsize=32k" pass "logbsize=32k" "true"
-do_test "-o logbsize=64k" fail
 
 # Test logdev
 do_mkfs
tests/xfs/513.out +0 -9
index eec8155d7..399459071 100644
@@ -13,10 +13,6 @@ FORMAT: -m crc=1
 TEST: "" "pass" "attr2" "true"
 TEST: "-o attr2" "pass" "attr2" "true"
 TEST: "-o noattr2" "fail"
-FORMAT: -m crc=0
-TEST: "" "pass" "attr2" "true"
-TEST: "-o attr2" "pass" "attr2" "true"
-TEST: "-o noattr2" "pass" "attr2" "false"
 FORMAT: 
 TEST: "" "pass" "discard" "false"
 TEST: "-o discard" "pass" "discard" "true"
@@ -51,11 +47,6 @@ TEST: "-o logbsize=128k" "pass" "logbsize=128k" "true"
 TEST: "-o logbsize=256k" "pass" "logbsize=256k" "true"
 TEST: "-o logbsize=8k" "fail"
 TEST: "-o logbsize=512k" "fail"
-FORMAT: -m crc=0 -l version=1
-TEST: "-o logbsize=16384" "pass" "logbsize=16k" "true"
-TEST: "-o logbsize=16k" "pass" "logbsize=16k" "true"
-TEST: "-o logbsize=32k" "pass" "logbsize=32k" "true"
-TEST: "-o logbsize=64k" "fail"
 FORMAT: 
 TEST: "" "pass" "logdev" "false"
 TEST: "-o logdev=LOOP_SPARE_DEV" "fail"
tests/xfs/613 new file +198 -0
new file mode 100755
index 000000000..522358cb3
@@ -0,0 +1,198 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 Red Hat, Inc. All Rights Reserved.
+#
+# FS QA Test No. 613
+#
+# XFS v4 mount options sanity check, refer to 'man 5 xfs'.
+#
+. ./common/preamble
+_begin_fstest auto mount prealloc
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+	$UMOUNT_PROG $LOOP_MNT 2>/dev/null
+	if [ -n "$LOOP_DEV" ];then
+		_destroy_loop_device $LOOP_DEV 2>/dev/null
+	fi
+	if [ -n "$LOOP_SPARE_DEV" ];then
+		_destroy_loop_device $LOOP_SPARE_DEV 2>/dev/null
+	fi
+	rm -f $LOOP_IMG
+	rm -f $LOOP_SPARE_IMG
+	rmdir $LOOP_MNT
+}
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_fixed_by_kernel_commit 237d7887ae72 \
+	"xfs: show the proper user quota options"
+
+_require_test
+_require_loop
+_require_xfs_io_command "falloc"
+
+LOOP_IMG=$TEST_DIR/$seq.dev
+LOOP_SPARE_IMG=$TEST_DIR/$seq.logdev
+LOOP_MNT=$TEST_DIR/$seq.mnt
+
+echo "** create loop device"
+$XFS_IO_PROG -f -c "truncate 32g" $LOOP_IMG
+LOOP_DEV=`_create_loop_device $LOOP_IMG`
+
+echo "** create loop log device"
+$XFS_IO_PROG -f -c "truncate 1g" $LOOP_SPARE_IMG
+LOOP_SPARE_DEV=`_create_loop_device $LOOP_SPARE_IMG`
+
+echo "** create loop mount point"
+rmdir $LOOP_MNT 2>/dev/null
+mkdir -p $LOOP_MNT || _fail "cannot create loopback mount point"
+
+filter_loop()
+{
+	sed -e "s,\B$LOOP_MNT,LOOP_MNT,g" \
+	    -e "s,\B$LOOP_DEV,LOOP_DEV,g" \
+	    -e "s,\B$LOOP_SPARE_DEV,LOOP_SPARE_DEV,g"
+}
+
+filter_xfs_opt()
+{
+	sed -e "s,allocsize=$pagesz,allocsize=PAGESIZE,g"
+}
+
+# avoid the effection from MKFS_OPTIONS
+MKFS_OPTIONS=""
+do_mkfs()
+{
+	echo "FORMAT: $@" | filter_loop | tee -a $seqres.full
+	$MKFS_XFS_PROG -f $* $LOOP_DEV | _filter_mkfs >>$seqres.full 2>$tmp.mkfs
+	if [ "${PIPESTATUS[0]}" -ne 0 ]; then
+		_fail "Fails on _mkfs_dev $* $LOOP_DEV"
+	fi
+	. $tmp.mkfs
+}
+
+is_dev_mounted()
+{
+	findmnt --source $LOOP_DEV >/dev/null
+	return $?
+}
+
+get_mount_info()
+{
+	findmnt --source $LOOP_DEV -o OPTIONS -n
+}
+
+force_unmount()
+{
+	$UMOUNT_PROG $LOOP_MNT >/dev/null 2>&1
+}
+
+# _do_test <mount options> <should be mounted?> [<key string> <key should be found?>]
+_do_test()
+{
+	local opts="$1"
+	local mounted="$2"	# pass or fail
+	local key="$3"
+	local found="$4"	# true or false
+	local rc
+	local info
+
+	# mount test
+	_mount $LOOP_DEV $LOOP_MNT $opts 2>>$seqres.full
+	rc=$?
+	if [ $rc -eq 0 ];then
+		if [ "${mounted}" = "fail" ];then
+			echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
+			echo "ERROR: expect mount to fail, but it succeeded"
+			return 1
+		fi
+		is_dev_mounted
+		if [ $? -ne 0 ];then
+			echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
+			echo "ERROR: fs not mounted even mount return 0"
+			return 1
+		fi
+	else
+		if [ "${mounted}" = "pass" ];then
+			echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
+			echo "ERROR: expect mount to succeed, but it failed"
+			return 1
+		fi
+		is_dev_mounted
+		if [ $? -eq 0 ];then
+			echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
+			echo "ERROR: fs is mounted even mount return non-zero"
+			return 1
+		fi
+	fi
+
+	# Skip below checking if "$key" argument isn't specified
+	if [ -z "$key" ];then
+		return 0
+	fi
+	# Check the mount options after fs mounted.
+	info=`get_mount_info`
+	echo ${info} | grep -q "${key}"
+	rc=$?
+	if [ $rc -eq 0 ];then
+		if [ "$found" != "true" ];then
+			echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
+			echo "ERROR: expected to find \"$key\" in mount info \"$info\""
+			return 1
+		fi
+	else
+		if [ "$found" != "false" ];then
+			echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
+			echo "ERROR: did not expect to find \"$key\" in \"$info\""
+			return 1
+		fi
+	fi
+
+	return 0
+}
+
+do_test()
+{
+	# Print each argument, include nil ones
+	echo -n "TEST:" | tee -a $seqres.full
+	for i in "$@";do
+		echo -n " \"$i\"" | filter_loop | filter_xfs_opt | tee -a $seqres.full
+	done
+	echo | tee -a $seqres.full
+
+	# force unmount before testing
+	force_unmount
+	_do_test "$@"
+	# force unmount after testing
+	force_unmount
+}
+
+echo "** start xfs mount testing ..."
+# Test attr2
+do_mkfs -m crc=0
+do_test "" pass "attr2" "true"
+do_test "-o attr2" pass "attr2" "true"
+do_test "-o noattr2" pass "attr2" "false"
+
+# Test logbsize=value.
+do_mkfs -m crc=0 -l version=1
+# New kernel (refer to 4f62282a3696 xfs: cleanup xlog_get_iclog_buffer_size)
+# prints "logbsize=N" in /proc/mounts, but old kernel not. So the default
+# 'display' about logbsize can't be expected, disable this test.
+#do_test "" pass "logbsize" "false"
+do_test "-o logbsize=16384" pass "logbsize=16k" "true"
+do_test "-o logbsize=16k" pass "logbsize=16k" "true"
+do_test "-o logbsize=32k" pass "logbsize=32k" "true"
+do_test "-o logbsize=64k" fail
+
+echo "** end of testing"
+# success, all done
+status=0
+exit
tests/xfs/613.out new file +15 -0
new file mode 100644
index 000000000..1624617ee
@@ -0,0 +1,15 @@
+QA output created by 613
+** create loop device
+** create loop log device
+** create loop mount point
+** start xfs mount testing ...
+FORMAT: -m crc=0
+TEST: "" "pass" "attr2" "true"
+TEST: "-o attr2" "pass" "attr2" "true"
+TEST: "-o noattr2" "pass" "attr2" "false"
+FORMAT: -m crc=0 -l version=1
+TEST: "-o logbsize=16384" "pass" "logbsize=16k" "true"
+TEST: "-o logbsize=16k" "pass" "logbsize=16k" "true"
+TEST: "-o logbsize=32k" "pass" "logbsize=32k" "true"
+TEST: "-o logbsize=64k" "fail"
+** end of testing
Signature · 1 line
2.39.2
#7 lore raw

Re: [PATCH 3/5] xfs/512: split out v4 specific tests

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

Split the v4-specific tests into a new xfs/613.

---
 tests/xfs/513     |  13 ---
 tests/xfs/513.out |   9 ---
 tests/xfs/613     | 198 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/613.out |  15 ++++

Such numerological coincidence!

I had to skip a few numbers for that, but they'll fill up soon..

#8 lore raw

PATCH 4/5 xfs/{158,160}: split out v4 tests

In reply to Christoph Hellwig

Move the subtests that check we can't upgrade v4 file systems to a separate test.

---
 tests/xfs/158     |  5 -----
 tests/xfs/158.out |  3 ---
 tests/xfs/160     |  5 -----
 tests/xfs/160.out |  3 ---
 tests/xfs/612     | 32 ++++++++++++++++++++++++++++++++
 tests/xfs/612.out |  7 +++++++
 6 files changed, 39 insertions(+), 16 deletions(-)
 create mode 100755 tests/xfs/612
 create mode 100644 tests/xfs/612.out
tests/xfs/158 +0 -5
index 4440adf6e..9f03eb528 100755
@@ -23,11 +23,6 @@ _require_xfs_repair_upgrade inobtcount
 _scratch_mkfs -m crc=1,inobtcount=1,finobt=0 &> $seqres.full && \
 	echo "Should not be able to format with inobtcount but not finobt."
 
-# Make sure we can't upgrade a V4 filesystem
-_scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
-_scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
-_check_scratch_xfs_features INOBTCNT
-
 # Make sure we can't upgrade a filesystem to inobtcount without finobt.
 _scratch_mkfs -m crc=1,inobtcount=0,finobt=0 >> $seqres.full
 _scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
tests/xfs/158.out +0 -3
index 5461031a3..3bc043e43 100644
@@ -1,8 +1,5 @@
 QA output created by 158
 Running xfs_repair to upgrade filesystem.
-Inode btree count feature only supported on V5 filesystems.
-FEATURES: INOBTCNT:NO
-Running xfs_repair to upgrade filesystem.
 Inode btree count feature requires free inode btree.
 FEATURES: INOBTCNT:NO
 Fail partway through upgrading
tests/xfs/160 +0 -5
index 399fe4bcf..d11eaba3c 100755
@@ -22,11 +22,6 @@ _require_xfs_repair_upgrade bigtime
 date --date='Jan 1 00:00:00 UTC 2040' > /dev/null 2>&1 || \
 	_notrun "Userspace does not support dates past 2038."
 
-# Make sure we can't upgrade a V4 filesystem
-_scratch_mkfs -m crc=0 >> $seqres.full
-_scratch_xfs_admin -O bigtime=1 2>> $seqres.full
-_check_scratch_xfs_features BIGTIME
-
 # Make sure we're required to specify a feature status
 _scratch_mkfs -m crc=1,bigtime=0,inobtcount=0 >> $seqres.full
 _scratch_xfs_admin -O bigtime 2>> $seqres.full
tests/xfs/160.out +0 -3
index 58fdd68da..9a7647f25 100644
@@ -1,8 +1,5 @@
 QA output created by 160
 Running xfs_repair to upgrade filesystem.
-Large timestamp feature only supported on V5 filesystems.
-FEATURES: BIGTIME:NO
-Running xfs_repair to upgrade filesystem.
 Running xfs_repair to upgrade filesystem.
 Adding inode btree counts to filesystem.
 Adding large timestamp support to filesystem.
tests/xfs/612 new file +32 -0
new file mode 100755
index 000000000..4ae4d3977
@@ -0,0 +1,32 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 612
+# 
+# Check that we can upgrade v5 only features on a v4 file system
+
+. ./common/preamble
+_begin_fstest auto quick
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch_xfs_inobtcount
+_require_command "$XFS_ADMIN_PROG" "xfs_admin"
+_require_xfs_repair_upgrade inobtcount
+
+# Make sure we can't upgrade to inobt on a V4 filesystem
+_scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
+_scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
+_check_scratch_xfs_features INOBTCNT
+
+# Make sure we can't upgrade to bigtim on a V4 filesystem
+_scratch_mkfs -m crc=0 >> $seqres.full
+_scratch_xfs_admin -O bigtime=1 2>> $seqres.full
+_check_scratch_xfs_features BIGTIME
+
+status=0
+exit
tests/xfs/612.out new file +7 -0
new file mode 100644
index 000000000..6908c15f8
@@ -0,0 +1,7 @@
+QA output created by 612
+Running xfs_repair to upgrade filesystem.
+Inode btree count feature only supported on V5 filesystems.
+FEATURES: INOBTCNT:NO
+Running xfs_repair to upgrade filesystem.
+Large timestamp feature only supported on V5 filesystems.
+FEATURES: BIGTIME:NO
Signature · 1 line
2.39.2
Reviewed-by on v1 4/5
#9 lore raw

Re: [PATCH 4/5] xfs/{158,160}: split out v4 tests

Quoted 4 lines · Christoph Hellwig

Move the subtests that check we can't upgrade v4 file systems to a separate test.

Looks good,

--D

Quoted 124 lines
---
 tests/xfs/158     |  5 -----
 tests/xfs/158.out |  3 ---
 tests/xfs/160     |  5 -----
 tests/xfs/160.out |  3 ---
 tests/xfs/612     | 32 ++++++++++++++++++++++++++++++++
 tests/xfs/612.out |  7 +++++++
 6 files changed, 39 insertions(+), 16 deletions(-)
 create mode 100755 tests/xfs/612
 create mode 100644 tests/xfs/612.out
tests/xfs/158 +0 -5
index 4440adf6e..9f03eb528 100755
@@ -23,11 +23,6 @@ _require_xfs_repair_upgrade inobtcount
 _scratch_mkfs -m crc=1,inobtcount=1,finobt=0 &> $seqres.full && \
 	echo "Should not be able to format with inobtcount but not finobt."
 
-# Make sure we can't upgrade a V4 filesystem
-_scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
-_scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
-_check_scratch_xfs_features INOBTCNT
-
 # Make sure we can't upgrade a filesystem to inobtcount without finobt.
 _scratch_mkfs -m crc=1,inobtcount=0,finobt=0 >> $seqres.full
 _scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
tests/xfs/158.out +0 -3
index 5461031a3..3bc043e43 100644
@@ -1,8 +1,5 @@
 QA output created by 158
 Running xfs_repair to upgrade filesystem.
-Inode btree count feature only supported on V5 filesystems.
-FEATURES: INOBTCNT:NO
-Running xfs_repair to upgrade filesystem.
 Inode btree count feature requires free inode btree.
 FEATURES: INOBTCNT:NO
 Fail partway through upgrading
tests/xfs/160 +0 -5
index 399fe4bcf..d11eaba3c 100755
@@ -22,11 +22,6 @@ _require_xfs_repair_upgrade bigtime
 date --date='Jan 1 00:00:00 UTC 2040' > /dev/null 2>&1 || \
 	_notrun "Userspace does not support dates past 2038."
 
-# Make sure we can't upgrade a V4 filesystem
-_scratch_mkfs -m crc=0 >> $seqres.full
-_scratch_xfs_admin -O bigtime=1 2>> $seqres.full
-_check_scratch_xfs_features BIGTIME
-
 # Make sure we're required to specify a feature status
 _scratch_mkfs -m crc=1,bigtime=0,inobtcount=0 >> $seqres.full
 _scratch_xfs_admin -O bigtime 2>> $seqres.full
tests/xfs/160.out +0 -3
index 58fdd68da..9a7647f25 100644
@@ -1,8 +1,5 @@
 QA output created by 160
 Running xfs_repair to upgrade filesystem.
-Large timestamp feature only supported on V5 filesystems.
-FEATURES: BIGTIME:NO
-Running xfs_repair to upgrade filesystem.
 Running xfs_repair to upgrade filesystem.
 Adding inode btree counts to filesystem.
 Adding large timestamp support to filesystem.
tests/xfs/612 new file +32 -0
new file mode 100755
index 000000000..4ae4d3977
@@ -0,0 +1,32 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 612
+# 
+# Check that we can upgrade v5 only features on a v4 file system
+
+. ./common/preamble
+_begin_fstest auto quick
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch_xfs_inobtcount
+_require_command "$XFS_ADMIN_PROG" "xfs_admin"
+_require_xfs_repair_upgrade inobtcount
+
+# Make sure we can't upgrade to inobt on a V4 filesystem
+_scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
+_scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
+_check_scratch_xfs_features INOBTCNT
+
+# Make sure we can't upgrade to bigtim on a V4 filesystem
+_scratch_mkfs -m crc=0 >> $seqres.full
+_scratch_xfs_admin -O bigtime=1 2>> $seqres.full
+_check_scratch_xfs_features BIGTIME
+
+status=0
+exit
tests/xfs/612.out new file +7 -0
new file mode 100644
index 000000000..6908c15f8
@@ -0,0 +1,7 @@
+QA output created by 612
+Running xfs_repair to upgrade filesystem.
+Inode btree count feature only supported on V5 filesystems.
+FEATURES: INOBTCNT:NO
+Running xfs_repair to upgrade filesystem.
+Large timestamp feature only supported on V5 filesystems.
+FEATURES: BIGTIME:NO
Signature · 1 line
2.39.2
#10 lore raw

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

In reply to 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.

---
 common/xfs    | 10 ++++++++++
 tests/xfs/002 |  1 +
 tests/xfs/095 |  1 +
 tests/xfs/096 |  1 +
 tests/xfs/132 |  1 +
 tests/xfs/148 |  6 ++++++
 tests/xfs/194 | 10 ++++++++++
 tests/xfs/199 |  1 +
 tests/xfs/300 |  1 +
 tests/xfs/526 |  3 +++
 tests/xfs/612 |  1 +
 tests/xfs/613 |  1 +
 12 files changed, 37 insertions(+)
common/xfs +10 -0
index 49ca5a2d5..733c3a5be 100644
@@ -1852,3 +1852,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 -0
index 8dfd2693b..26d0cd6e4 100755
@@ -23,6 +23,7 @@ _begin_fstest auto quick growfs
 _supported_fs xfs
 _require_scratch_nocheck
 _require_no_large_scratch_dev
+_require_xfs_nocrc
 
 _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed"
 
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/096 +1 -0
index 7eff6cb1d..0a1bfb3fa 100755
@@ -20,6 +20,7 @@ _supported_fs xfs
 
 _require_scratch
 _require_xfs_quota
+_require_xfs_nocrc
 
 function option_string()
 {
tests/xfs/132 +1 -0
index ee1c8c1ec..b46d3d28c 100755
@@ -19,6 +19,7 @@ _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.
tests/xfs/148 +6 -0
index c9f634cfd..fde3bf476 100755
@@ -27,6 +27,8 @@ _cleanup()
 _supported_fs xfs
 _require_test
 _require_attrs
+_require_xfs_nocrc
+
 _disable_dmesg_check
 
 imgfile=$TEST_DIR/img-$seq
@@ -40,6 +42,10 @@ test_names=("something" "$nullstr" "$slashstr" "another")
 rm -f $imgfile $imgfile.old
 
 # Format image file w/o crcs so we can sed the image file
+#
+# TODO: It might be possible to rewrite this using proper xfs_db
+# fs manipulation commands that would work with CRCs.
+#
 # We need to use 512 byte inodes to ensure the attr forks remain in short form
 # even when security xattrs are present so we are always doing name matches on
 # lookup and not name hash compares as leaf/node forms will do.
tests/xfs/194 +10 -0
index 5a1dff5d2..2fcc55b3e 100755
@@ -30,6 +30,16 @@ _supported_fs xfs
 # real QA test starts here
 
 _require_scratch
+
+#
+# This currently forces nocrc because only that can support 512 byte block size
+# and thus block size = 1/8 page size on 4k page size systems.
+# In theory we could run it on systems with larger page size with CRCs, or hope
+# that large folios would trigger the same issue.
+# But for now that is left as an exercise for the reader.
+#
+_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/300 +1 -0
index 2ee5eee71..bc1f0efc6 100755
@@ -13,6 +13,7 @@ _begin_fstest auto fsr
 . ./common/filter
 
 _require_scratch
+_require_xfs_nocrc
 
 # real QA test starts here
 
tests/xfs/526 +3 -0
index 4261e8497..c5c5f9b1a 100755
@@ -27,6 +27,9 @@ _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
 
+# Currently the only conflicting options are v4 specific
+_require_xfs_nocrc
+
 cfgfile=$TEST_DIR/a
 rm -rf $cfgfile
 
tests/xfs/612 +1 -0
index 4ae4d3977..0f6df7deb 100755
@@ -17,6 +17,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 upgrade to inobt on a V4 filesystem
 _scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
tests/xfs/613 +1 -0
index 522358cb3..8bff21711 100755
@@ -34,6 +34,7 @@ _supported_fs xfs
 _fixed_by_kernel_commit 237d7887ae72 \
 	"xfs: show the proper user quota options"
 
+_require_xfs_nocrc
 _require_test
 _require_loop
 _require_xfs_io_command "falloc"
Signature · 1 line
2.39.2
Reviewed-by on v1 5/5
#11 lore raw

Re: [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported

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

Looks ok,

--D

Quoted 192 lines
---
 common/xfs    | 10 ++++++++++
 tests/xfs/002 |  1 +
 tests/xfs/095 |  1 +
 tests/xfs/096 |  1 +
 tests/xfs/132 |  1 +
 tests/xfs/148 |  6 ++++++
 tests/xfs/194 | 10 ++++++++++
 tests/xfs/199 |  1 +
 tests/xfs/300 |  1 +
 tests/xfs/526 |  3 +++
 tests/xfs/612 |  1 +
 tests/xfs/613 |  1 +
 12 files changed, 37 insertions(+)
common/xfs +10 -0
index 49ca5a2d5..733c3a5be 100644
@@ -1852,3 +1852,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 -0
index 8dfd2693b..26d0cd6e4 100755
@@ -23,6 +23,7 @@ _begin_fstest auto quick growfs
 _supported_fs xfs
 _require_scratch_nocheck
 _require_no_large_scratch_dev
+_require_xfs_nocrc
 
 _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed"
 
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/096 +1 -0
index 7eff6cb1d..0a1bfb3fa 100755
@@ -20,6 +20,7 @@ _supported_fs xfs
 
 _require_scratch
 _require_xfs_quota
+_require_xfs_nocrc
 
 function option_string()
 {
tests/xfs/132 +1 -0
index ee1c8c1ec..b46d3d28c 100755
@@ -19,6 +19,7 @@ _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.
tests/xfs/148 +6 -0
index c9f634cfd..fde3bf476 100755
@@ -27,6 +27,8 @@ _cleanup()
 _supported_fs xfs
 _require_test
 _require_attrs
+_require_xfs_nocrc
+
 _disable_dmesg_check
 
 imgfile=$TEST_DIR/img-$seq
@@ -40,6 +42,10 @@ test_names=("something" "$nullstr" "$slashstr" "another")
 rm -f $imgfile $imgfile.old
 
 # Format image file w/o crcs so we can sed the image file
+#
+# TODO: It might be possible to rewrite this using proper xfs_db
+# fs manipulation commands that would work with CRCs.
+#
 # We need to use 512 byte inodes to ensure the attr forks remain in short form
 # even when security xattrs are present so we are always doing name matches on
 # lookup and not name hash compares as leaf/node forms will do.
tests/xfs/194 +10 -0
index 5a1dff5d2..2fcc55b3e 100755
@@ -30,6 +30,16 @@ _supported_fs xfs
 # real QA test starts here
 
 _require_scratch
+
+#
+# This currently forces nocrc because only that can support 512 byte block size
+# and thus block size = 1/8 page size on 4k page size systems.
+# In theory we could run it on systems with larger page size with CRCs, or hope
+# that large folios would trigger the same issue.
+# But for now that is left as an exercise for the reader.
+#
+_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/300 +1 -0
index 2ee5eee71..bc1f0efc6 100755
@@ -13,6 +13,7 @@ _begin_fstest auto fsr
 . ./common/filter
 
 _require_scratch
+_require_xfs_nocrc
 
 # real QA test starts here
 
tests/xfs/526 +3 -0
index 4261e8497..c5c5f9b1a 100755
@@ -27,6 +27,9 @@ _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
 
+# Currently the only conflicting options are v4 specific
+_require_xfs_nocrc
+
 cfgfile=$TEST_DIR/a
 rm -rf $cfgfile
 
tests/xfs/612 +1 -0
index 4ae4d3977..0f6df7deb 100755
@@ -17,6 +17,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 upgrade to inobt on a V4 filesystem
 _scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
tests/xfs/613 +1 -0
index 522358cb3..8bff21711 100755
@@ -34,6 +34,7 @@ _supported_fs xfs
 _fixed_by_kernel_commit 237d7887ae72 \
 	"xfs: show the proper user quota options"
 
+_require_xfs_nocrc
 _require_test
 _require_loop
 _require_xfs_io_command "falloc"
Signature · 1 line
2.39.2