fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fix kernels without v5 support v2
@ 2024-04-18  7:40 Christoph Hellwig
  2024-04-18  7:40 ` [PATCH 1/5] xfs/045: don't force v4 file systems Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18  7:40 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Darrick J . Wong , linux-xfs, fstests

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] xfs/045: don't force v4 file systems
  2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
@ 2024-04-18  7:40 ` Christoph Hellwig
  2024-04-18 14:55   ` Darrick J. Wong
  2024-04-18  7:40 ` [PATCH 2/5] xfs/263: split out the v4 test Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18  7:40 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Darrick J . Wong , linux-xfs, fstests

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/xfs/045 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/xfs/045 b/tests/xfs/045
index d8cc9ac29..a596635ec 100755
--- a/tests/xfs/045
+++ b/tests/xfs/045
@@ -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"
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] xfs/263: split out the v4 test
  2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
  2024-04-18  7:40 ` [PATCH 1/5] xfs/045: don't force v4 file systems Christoph Hellwig
@ 2024-04-18  7:40 ` Christoph Hellwig
  2024-04-18 14:55   ` Darrick J. Wong
  2024-04-18  7:40 ` [PATCH 3/5] xfs/512: split out v4 specific tests Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18  7:40 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Darrick J . Wong , linux-xfs, fstests

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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

diff --git a/tests/xfs/096 b/tests/xfs/096
new file mode 100755
index 000000000..7eff6cb1d
--- /dev/null
+++ b/tests/xfs/096
@@ -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
diff --git a/tests/xfs/096.out b/tests/xfs/096.out
new file mode 100644
index 000000000..1deb7a8c3
--- /dev/null
+++ b/tests/xfs/096.out
@@ -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 ==
diff --git a/tests/xfs/263 b/tests/xfs/263
index bd30dab11..54e9355aa 100755
--- a/tests/xfs/263
+++ b/tests/xfs/263
@@ -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
 
diff --git a/tests/xfs/263.out b/tests/xfs/263.out
index 531d45de5..64c1a5876 100644
--- a/tests/xfs/263.out
+++ b/tests/xfs/263.out
@@ -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)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] xfs/512: split out v4 specific tests
  2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
  2024-04-18  7:40 ` [PATCH 1/5] xfs/045: don't force v4 file systems Christoph Hellwig
  2024-04-18  7:40 ` [PATCH 2/5] xfs/263: split out the v4 test Christoph Hellwig
@ 2024-04-18  7:40 ` Christoph Hellwig
  2024-04-18 14:56   ` Darrick J. Wong
  2024-04-18  7:40 ` [PATCH 4/5] xfs/{158,160}: split out v4 tests Christoph Hellwig
  2024-04-18  7:40 ` [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported Christoph Hellwig
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18  7:40 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Darrick J . Wong , linux-xfs, fstests

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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

diff --git a/tests/xfs/513 b/tests/xfs/513
index ce2bb3491..3a85ed429 100755
--- a/tests/xfs/513
+++ b/tests/xfs/513
@@ -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
diff --git a/tests/xfs/513.out b/tests/xfs/513.out
index eec8155d7..399459071 100644
--- a/tests/xfs/513.out
+++ b/tests/xfs/513.out
@@ -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"
diff --git a/tests/xfs/613 b/tests/xfs/613
new file mode 100755
index 000000000..522358cb3
--- /dev/null
+++ b/tests/xfs/613
@@ -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
diff --git a/tests/xfs/613.out b/tests/xfs/613.out
new file mode 100644
index 000000000..1624617ee
--- /dev/null
+++ b/tests/xfs/613.out
@@ -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
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] xfs/{158,160}: split out v4 tests
  2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2024-04-18  7:40 ` [PATCH 3/5] xfs/512: split out v4 specific tests Christoph Hellwig
@ 2024-04-18  7:40 ` Christoph Hellwig
  2024-04-18 15:00   ` Darrick J. Wong
  2024-04-18  7:40 ` [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported Christoph Hellwig
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18  7:40 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Darrick J . Wong , linux-xfs, fstests

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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

diff --git a/tests/xfs/158 b/tests/xfs/158
index 4440adf6e..9f03eb528 100755
--- a/tests/xfs/158
+++ b/tests/xfs/158
@@ -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
diff --git a/tests/xfs/158.out b/tests/xfs/158.out
index 5461031a3..3bc043e43 100644
--- a/tests/xfs/158.out
+++ b/tests/xfs/158.out
@@ -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
diff --git a/tests/xfs/160 b/tests/xfs/160
index 399fe4bcf..d11eaba3c 100755
--- a/tests/xfs/160
+++ b/tests/xfs/160
@@ -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
diff --git a/tests/xfs/160.out b/tests/xfs/160.out
index 58fdd68da..9a7647f25 100644
--- a/tests/xfs/160.out
+++ b/tests/xfs/160.out
@@ -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.
diff --git a/tests/xfs/612 b/tests/xfs/612
new file mode 100755
index 000000000..4ae4d3977
--- /dev/null
+++ b/tests/xfs/612
@@ -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
diff --git a/tests/xfs/612.out b/tests/xfs/612.out
new file mode 100644
index 000000000..6908c15f8
--- /dev/null
+++ b/tests/xfs/612.out
@@ -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
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported
  2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2024-04-18  7:40 ` [PATCH 4/5] xfs/{158,160}: split out v4 tests Christoph Hellwig
@ 2024-04-18  7:40 ` Christoph Hellwig
  2024-04-18 15:02   ` Darrick J. Wong
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18  7:40 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Darrick J . Wong , linux-xfs, fstests

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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(+)

diff --git a/common/xfs b/common/xfs
index 49ca5a2d5..733c3a5be 100644
--- a/common/xfs
+++ b/common/xfs
@@ -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
+}
diff --git a/tests/xfs/002 b/tests/xfs/002
index 8dfd2693b..26d0cd6e4 100755
--- a/tests/xfs/002
+++ b/tests/xfs/002
@@ -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"
 
diff --git a/tests/xfs/095 b/tests/xfs/095
index a3891c85e..e7dc3e9f4 100755
--- a/tests/xfs/095
+++ b/tests/xfs/095
@@ -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"
diff --git a/tests/xfs/096 b/tests/xfs/096
index 7eff6cb1d..0a1bfb3fa 100755
--- a/tests/xfs/096
+++ b/tests/xfs/096
@@ -20,6 +20,7 @@ _supported_fs xfs
 
 _require_scratch
 _require_xfs_quota
+_require_xfs_nocrc
 
 function option_string()
 {
diff --git a/tests/xfs/132 b/tests/xfs/132
index ee1c8c1ec..b46d3d28c 100755
--- a/tests/xfs/132
+++ b/tests/xfs/132
@@ -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.
diff --git a/tests/xfs/148 b/tests/xfs/148
index c9f634cfd..fde3bf476 100755
--- a/tests/xfs/148
+++ b/tests/xfs/148
@@ -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.
diff --git a/tests/xfs/194 b/tests/xfs/194
index 5a1dff5d2..2fcc55b3e 100755
--- a/tests/xfs/194
+++ b/tests/xfs/194
@@ -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
diff --git a/tests/xfs/199 b/tests/xfs/199
index 4669f2c3e..f99b04db3 100755
--- a/tests/xfs/199
+++ b/tests/xfs/199
@@ -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.
diff --git a/tests/xfs/300 b/tests/xfs/300
index 2ee5eee71..bc1f0efc6 100755
--- a/tests/xfs/300
+++ b/tests/xfs/300
@@ -13,6 +13,7 @@ _begin_fstest auto fsr
 . ./common/filter
 
 _require_scratch
+_require_xfs_nocrc
 
 # real QA test starts here
 
diff --git a/tests/xfs/526 b/tests/xfs/526
index 4261e8497..c5c5f9b1a 100755
--- a/tests/xfs/526
+++ b/tests/xfs/526
@@ -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
 
diff --git a/tests/xfs/612 b/tests/xfs/612
index 4ae4d3977..0f6df7deb 100755
--- a/tests/xfs/612
+++ b/tests/xfs/612
@@ -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
diff --git a/tests/xfs/613 b/tests/xfs/613
index 522358cb3..8bff21711 100755
--- a/tests/xfs/613
+++ b/tests/xfs/613
@@ -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"
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] xfs/045: don't force v4 file systems
  2024-04-18  7:40 ` [PATCH 1/5] xfs/045: don't force v4 file systems Christoph Hellwig
@ 2024-04-18 14:55   ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-04-18 14:55 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Zorro Lang, linux-xfs, fstests

On Thu, Apr 18, 2024 at 09:40:42AM +0200, Christoph Hellwig wrote:
> xfs_db can change UUIDs on v5 filesystems now, so we don't need the
> -mcrc=0 in this test.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Makes sense,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/xfs/045 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tests/xfs/045 b/tests/xfs/045
> index d8cc9ac29..a596635ec 100755
> --- a/tests/xfs/045
> +++ b/tests/xfs/045
> @@ -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"
> -- 
> 2.39.2
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] xfs/263: split out the v4 test
  2024-04-18  7:40 ` [PATCH 2/5] xfs/263: split out the v4 test Christoph Hellwig
@ 2024-04-18 14:55   ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-04-18 14:55 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Zorro Lang, linux-xfs, fstests

On Thu, Apr 18, 2024 at 09:40:43AM +0200, Christoph Hellwig wrote:
> Move the v4-specific test into a separate test case so that we can still
> run the tests on a kernel without v4 support.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Awwright!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  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
> 
> diff --git a/tests/xfs/096 b/tests/xfs/096
> new file mode 100755
> index 000000000..7eff6cb1d
> --- /dev/null
> +++ b/tests/xfs/096
> @@ -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
> diff --git a/tests/xfs/096.out b/tests/xfs/096.out
> new file mode 100644
> index 000000000..1deb7a8c3
> --- /dev/null
> +++ b/tests/xfs/096.out
> @@ -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 ==
> diff --git a/tests/xfs/263 b/tests/xfs/263
> index bd30dab11..54e9355aa 100755
> --- a/tests/xfs/263
> +++ b/tests/xfs/263
> @@ -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
>  
> diff --git a/tests/xfs/263.out b/tests/xfs/263.out
> index 531d45de5..64c1a5876 100644
> --- a/tests/xfs/263.out
> +++ b/tests/xfs/263.out
> @@ -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)
> -- 
> 2.39.2
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/5] xfs/512: split out v4 specific tests
  2024-04-18  7:40 ` [PATCH 3/5] xfs/512: split out v4 specific tests Christoph Hellwig
@ 2024-04-18 14:56   ` Darrick J. Wong
  2024-04-18 15:00     ` Christoph Hellwig
  0 siblings, 1 reply; 12+ messages in thread
From: Darrick J. Wong @ 2024-04-18 14:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Zorro Lang, linux-xfs, fstests

On Thu, Apr 18, 2024 at 09:40:44AM +0200, Christoph Hellwig wrote:
> Split the v4-specific tests into a new xfs/613.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/xfs/513     |  13 ---
>  tests/xfs/513.out |   9 ---
>  tests/xfs/613     | 198 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/613.out |  15 ++++

Such numerological coincidence!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  4 files changed, 213 insertions(+), 22 deletions(-)
>  create mode 100755 tests/xfs/613
>  create mode 100644 tests/xfs/613.out
> 
> diff --git a/tests/xfs/513 b/tests/xfs/513
> index ce2bb3491..3a85ed429 100755
> --- a/tests/xfs/513
> +++ b/tests/xfs/513
> @@ -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
> diff --git a/tests/xfs/513.out b/tests/xfs/513.out
> index eec8155d7..399459071 100644
> --- a/tests/xfs/513.out
> +++ b/tests/xfs/513.out
> @@ -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"
> diff --git a/tests/xfs/613 b/tests/xfs/613
> new file mode 100755
> index 000000000..522358cb3
> --- /dev/null
> +++ b/tests/xfs/613
> @@ -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
> diff --git a/tests/xfs/613.out b/tests/xfs/613.out
> new file mode 100644
> index 000000000..1624617ee
> --- /dev/null
> +++ b/tests/xfs/613.out
> @@ -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
> -- 
> 2.39.2
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/5] xfs/{158,160}: split out v4 tests
  2024-04-18  7:40 ` [PATCH 4/5] xfs/{158,160}: split out v4 tests Christoph Hellwig
@ 2024-04-18 15:00   ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-04-18 15:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Zorro Lang, linux-xfs, fstests

On Thu, Apr 18, 2024 at 09:40:45AM +0200, Christoph Hellwig wrote:
> Move the subtests that check we can't upgrade v4 file systems to a
> separate test.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  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
> 
> diff --git a/tests/xfs/158 b/tests/xfs/158
> index 4440adf6e..9f03eb528 100755
> --- a/tests/xfs/158
> +++ b/tests/xfs/158
> @@ -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
> diff --git a/tests/xfs/158.out b/tests/xfs/158.out
> index 5461031a3..3bc043e43 100644
> --- a/tests/xfs/158.out
> +++ b/tests/xfs/158.out
> @@ -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
> diff --git a/tests/xfs/160 b/tests/xfs/160
> index 399fe4bcf..d11eaba3c 100755
> --- a/tests/xfs/160
> +++ b/tests/xfs/160
> @@ -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
> diff --git a/tests/xfs/160.out b/tests/xfs/160.out
> index 58fdd68da..9a7647f25 100644
> --- a/tests/xfs/160.out
> +++ b/tests/xfs/160.out
> @@ -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.
> diff --git a/tests/xfs/612 b/tests/xfs/612
> new file mode 100755
> index 000000000..4ae4d3977
> --- /dev/null
> +++ b/tests/xfs/612
> @@ -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
> diff --git a/tests/xfs/612.out b/tests/xfs/612.out
> new file mode 100644
> index 000000000..6908c15f8
> --- /dev/null
> +++ b/tests/xfs/612.out
> @@ -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
> -- 
> 2.39.2
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/5] xfs/512: split out v4 specific tests
  2024-04-18 14:56   ` Darrick J. Wong
@ 2024-04-18 15:00     ` Christoph Hellwig
  0 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2024-04-18 15:00 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, linux-xfs, fstests

On Thu, Apr 18, 2024 at 07:56:39AM -0700, Darrick J. Wong wrote:
> On Thu, Apr 18, 2024 at 09:40:44AM +0200, Christoph Hellwig wrote:
> > Split the v4-specific tests into a new xfs/613.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  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..


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported
  2024-04-18  7:40 ` [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported Christoph Hellwig
@ 2024-04-18 15:02   ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-04-18 15:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Zorro Lang, linux-xfs, fstests

On Thu, Apr 18, 2024 at 09:40:46AM +0200, Christoph Hellwig wrote:
> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  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(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 49ca5a2d5..733c3a5be 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -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
> +}
> diff --git a/tests/xfs/002 b/tests/xfs/002
> index 8dfd2693b..26d0cd6e4 100755
> --- a/tests/xfs/002
> +++ b/tests/xfs/002
> @@ -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"
>  
> diff --git a/tests/xfs/095 b/tests/xfs/095
> index a3891c85e..e7dc3e9f4 100755
> --- a/tests/xfs/095
> +++ b/tests/xfs/095
> @@ -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"
> diff --git a/tests/xfs/096 b/tests/xfs/096
> index 7eff6cb1d..0a1bfb3fa 100755
> --- a/tests/xfs/096
> +++ b/tests/xfs/096
> @@ -20,6 +20,7 @@ _supported_fs xfs
>  
>  _require_scratch
>  _require_xfs_quota
> +_require_xfs_nocrc
>  
>  function option_string()
>  {
> diff --git a/tests/xfs/132 b/tests/xfs/132
> index ee1c8c1ec..b46d3d28c 100755
> --- a/tests/xfs/132
> +++ b/tests/xfs/132
> @@ -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.
> diff --git a/tests/xfs/148 b/tests/xfs/148
> index c9f634cfd..fde3bf476 100755
> --- a/tests/xfs/148
> +++ b/tests/xfs/148
> @@ -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.
> diff --git a/tests/xfs/194 b/tests/xfs/194
> index 5a1dff5d2..2fcc55b3e 100755
> --- a/tests/xfs/194
> +++ b/tests/xfs/194
> @@ -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
> diff --git a/tests/xfs/199 b/tests/xfs/199
> index 4669f2c3e..f99b04db3 100755
> --- a/tests/xfs/199
> +++ b/tests/xfs/199
> @@ -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.
> diff --git a/tests/xfs/300 b/tests/xfs/300
> index 2ee5eee71..bc1f0efc6 100755
> --- a/tests/xfs/300
> +++ b/tests/xfs/300
> @@ -13,6 +13,7 @@ _begin_fstest auto fsr
>  . ./common/filter
>  
>  _require_scratch
> +_require_xfs_nocrc
>  
>  # real QA test starts here
>  
> diff --git a/tests/xfs/526 b/tests/xfs/526
> index 4261e8497..c5c5f9b1a 100755
> --- a/tests/xfs/526
> +++ b/tests/xfs/526
> @@ -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
>  
> diff --git a/tests/xfs/612 b/tests/xfs/612
> index 4ae4d3977..0f6df7deb 100755
> --- a/tests/xfs/612
> +++ b/tests/xfs/612
> @@ -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
> diff --git a/tests/xfs/613 b/tests/xfs/613
> index 522358cb3..8bff21711 100755
> --- a/tests/xfs/613
> +++ b/tests/xfs/613
> @@ -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"
> -- 
> 2.39.2
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-04-18 15:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
2024-04-18  7:40 ` [PATCH 1/5] xfs/045: don't force v4 file systems Christoph Hellwig
2024-04-18 14:55   ` Darrick J. Wong
2024-04-18  7:40 ` [PATCH 2/5] xfs/263: split out the v4 test Christoph Hellwig
2024-04-18 14:55   ` Darrick J. Wong
2024-04-18  7:40 ` [PATCH 3/5] xfs/512: split out v4 specific tests Christoph Hellwig
2024-04-18 14:56   ` Darrick J. Wong
2024-04-18 15:00     ` Christoph Hellwig
2024-04-18  7:40 ` [PATCH 4/5] xfs/{158,160}: split out v4 tests Christoph Hellwig
2024-04-18 15:00   ` Darrick J. Wong
2024-04-18  7:40 ` [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported Christoph Hellwig
2024-04-18 15:02   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).