]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: add a test that zoned file systems with rump RTG can't be mounted
authorChristoph Hellwig <hch@lst.de>
Fri, 19 Dec 2025 05:35:44 +0000 (06:35 +0100)
committerZorro Lang <zlang@kernel.org>
Wed, 31 Dec 2025 20:59:50 +0000 (04:59 +0800)
Garbage collection assumes all zones contain the full amount of blocks.
Mkfs already ensures this happens, but the kernel mount code did not
verify this.  Instead such a file system would eventually fail scrub.

Add a test to verify the new superblock verifier check.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/xfs/651 [new file with mode: 0755]
tests/xfs/651.out [new file with mode: 0644]

diff --git a/tests/xfs/651 b/tests/xfs/651
new file mode 100755 (executable)
index 0000000..b2d34af
--- /dev/null
@@ -0,0 +1,34 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Christoph Hellwig.
+#
+# FS QA Test No. 651
+#
+# Test that the sb verifier rejects zoned file system with rump RTGs.
+#
+. ./common/preamble
+_begin_fstest auto quick zone
+
+. ./common/zoned
+
+# we intentionally corrupt the superblock
+_require_scratch_nocheck
+
+_try_scratch_mkfs_xfs -r zoned=1 >> $seqres.full 2>&1 || \
+       _notrun "Can't create zoned file system"
+
+# adjust rblocks/rextents to not be zone aligned
+blocks=$(_scratch_xfs_get_sb_field rblocks)
+blocks=$((blocks - 4096))
+_scratch_xfs_set_sb_field rblocks ${blocks} >> $seqres.full 2>&1
+_scratch_xfs_set_sb_field rextents ${blocks} >> $seqres.full 2>&1
+
+if _try_scratch_mount >/dev/null 2>&1; then
+       echo "Mounted rump RTG file system (bad)"
+else
+       echo "Can't mount rump RTG file system (good)"
+fi
+
+
+status=0
+exit
diff --git a/tests/xfs/651.out b/tests/xfs/651.out
new file mode 100644 (file)
index 0000000..5d491b1
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 651
+Can't mount rump RTG file system (good)