Skip to contentSkip to conversation

xfs: add a test that zoned file systems with rump RTG can't be mounted

PATCH In review Christoph Hellwig 2 participants 3 messages Dec 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: add a test that zoned file systems with rump RTG can't be mounted

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.

---
 tests/xfs/651     | 27 +++++++++++++++++++++++++++
 tests/xfs/651.out |  2 ++
 2 files changed, 29 insertions(+)
 create mode 100755 tests/xfs/651
 create mode 100644 tests/xfs/651.out
tests/xfs/651 new file +27 -0
new file mode 100755
index 000000000000..3aef7a1d016f
@@ -0,0 +1,27 @@
+#! /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
+
+_require_scratch
+
+_scratch_mkfs > /dev/null 2>&1
+blocks=$(_scratch_xfs_db -c 'sb 0' -c 'print rblocks' | awk '{print $3}')
+blocks=$((blocks - 4096))
+_scratch_xfs_db -x -c 'sb 0' -c "write -d rblocks $blocks" > /dev/null 2>&1
+_scratch_xfs_db -x -c 'sb 0' -c "write -d rextents $blocks" > /dev/null 2>&1
+_try_scratch_mount || _notrun "Can't mount rump RTG file system"
+
+# for non-zoned file systems this can succeed
+_require_xfs_scratch_zoned
+
+status=0
+exit
tests/xfs/651.out new file +2 -0
new file mode 100644
index 000000000000..62617d172811
@@ -0,0 +1,2 @@
+QA output created by 651
+Can't mount rump RTG file system
Signature · 1 line
2.47.3
#1 lore raw
Quoted 27 lines · Christoph Hellwig

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.

---
 tests/xfs/651     | 27 +++++++++++++++++++++++++++
 tests/xfs/651.out |  2 ++
 2 files changed, 29 insertions(+)
 create mode 100755 tests/xfs/651
 create mode 100644 tests/xfs/651.out
tests/xfs/651 new file +7 -0
new file mode 100755
index 000000000000..3aef7a1d016f
@@ -0,0 +1,27 @@
+#! /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.

tests/xfs/651 line 17

Quoted 10 lines
tests/xfs/651 new file +10 -0
+#
+. ./common/preamble
+_begin_fstest auto quick zone
+
+. ./common/zoned
+
+_require_scratch
+
+_scratch_mkfs > /dev/null 2>&1
+blocks=$(_scratch_xfs_db -c 'sb 0' -c 'print rblocks' | awk '{print $3}')

blocks="$(_scratch_xfs_get_metadata_field rblocks 'sb 0')"

tests/xfs/651 line 21

Quoted 4 lines
tests/xfs/651 new file +4 -0
+blocks=$((blocks - 4096))
+_scratch_xfs_db -x -c 'sb 0' -c "write -d rblocks $blocks" > /dev/null 2>&1
+_scratch_xfs_db -x -c 'sb 0' -c "write -d rextents $blocks" > /dev/null 2>&1
+_try_scratch_mount || _notrun "Can't mount rump RTG file system"

Doesn't the _notrun here cause the test to be "skipped" when in fact it actually exhibits the behavior that you want (i.e. it passes)?

--D

Quoted 18 lines
tests/xfs/651 new file +6 -0
+
+# for non-zoned file systems this can succeed
+_require_xfs_scratch_zoned
+
+status=0
+exit
tests/xfs/651.out new file +2 -0
new file mode 100644
index 000000000000..62617d172811
@@ -0,0 +1,2 @@
+QA output created by 651
+Can't mount rump RTG file system
Signature · 1 line
2.47.3
#2 lore raw
Quoted 4 lines · Darrick J. Wong

tests/xfs/651 line 17

Quoted 2 lines
tests/xfs/651 new file +2 -0
+_scratch_mkfs > /dev/null 2>&1
+blocks=$(_scratch_xfs_db -c 'sb 0' -c 'print rblocks' | awk '{print $3}')

blocks="$(_scratch_xfs_get_metadata_field rblocks 'sb 0')"

Ah, I had a vague memory something like this existed but could not find it.

Quoted 7 lines

tests/xfs/651 line 21

Quoted 4 lines
tests/xfs/651 new file +4 -0
+blocks=$((blocks - 4096))
+_scratch_xfs_db -x -c 'sb 0' -c "write -d rblocks $blocks" > /dev/null 2>&1
+_scratch_xfs_db -x -c 'sb 0' -c "write -d rextents $blocks" > /dev/null 2>&1
+_try_scratch_mount || _notrun "Can't mount rump RTG file system"

Doesn't the _notrun here cause the test to be "skipped" when in fact it actually exhibits the behavior that you want (i.e. it passes)?

Yes. Which sort of does what's intended (fail on broken behavior) but in a very odd way. I'll do this in a nicer way.