xfs: test libxfs handling of missing RT devices
PATCH 1/1 xfs: test libxfs handling of missing RT devices
Test that libxfs rejects initializing a file systems unless in debugger mode by running xfs_repair and xfs_db with missing arguments. For db additionally test that command that require a RT device still do not work even after libxfs can be initialized using a missing RT device.
--- tests/xfs/2300 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/2300.out | 14 ++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 tests/xfs/2300 create mode 100644 tests/xfs/2300.out
tests/xfs/2300 new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2026 Christoph Hellwig. +# +# FS QA Test No. 2300 +# +# Tests that repair refuses to work without -r argument, and xfs_db works fine +# even without it to check libxfs initialization behavior with missing RT +# devices. +# +. ./common/preamble +_begin_fstest auto quick repair db + +. ./common/filter + +_require_scratch_nocheck +_require_realtime + +if [ -z "$SCRATCH_RTDEV" ]; then + _notrun "external RT device required" +fi + +_scratch_mkfs >> $seqres.full 2>&1 + +echo "Dumping superblock using xfs_db without rtdev" +$XFS_DB_PROG $SCRATCH_DEV -c 'sb 0' -c 'p' >> $seqres.full + +echo "Loading RT superblock using xfs_db without rtdev, should fail" +$XFS_DB_PROG $SCRATCH_DEV -c 'rtsb' + +echo "Running xfs_repair -n without rt device, should fail" +$XFS_REPAIR_PROG -n $SCRATCH_DEV + +echo "Running xfs_repair without rt device, should fail" +$XFS_REPAIR_PROG $SCRATCH_DEV + + +status=0 +exit
tests/xfs/2300.out new file +14 -0
@@ -0,0 +1,14 @@ +QA output created by 2300 +Dumping superblock using xfs_db without rtdev +Loading RT superblock using xfs_db without rtdev, should fail +realtime device not loaded, use -R. +Running xfs_repair -n without rt device, should fail +Phase 1 - find and verify superblock... +xfs_repair: filesystem has a realtime subvolume +xfs_repair: realtime device init failed +xfs_repair: cannot repair this filesystem. Sorry. +Running xfs_repair without rt device, should fail +Phase 1 - find and verify superblock... +xfs_repair: filesystem has a realtime subvolume +xfs_repair: realtime device init failed +xfs_repair: cannot repair this filesystem. Sorry.
Signature · 1 line
2.53.0
Quoted 6 lines · Christoph Hellwig
Test that libxfs rejects initializing a file systems unless in debugger mode by running
xfs_repairandxfs_dbwith missing arguments. For db additionally test that command that require a RT device still do not work even after libxfs can be initialized using a missing RT device.Signed-off-by Christoph Hellwig <[email protected]>
Looks good now!
--D
Quoted 76 lines
--- tests/xfs/2300 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/2300.out | 14 ++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 tests/xfs/2300 create mode 100644 tests/xfs/2300.outtests/xfs/2300 new file +39
-0@@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2026 Christoph Hellwig. +# +# FS QA Test No. 2300 +# +# Tests that repair refuses to work without -r argument, and xfs_db works fine +# even without it to check libxfs initialization behavior with missing RT +# devices. +# +. ./common/preamble +_begin_fstest auto quick repair db + +. ./common/filter + +_require_scratch_nocheck +_require_realtime + +if [ -z "$SCRATCH_RTDEV" ]; then + _notrun "external RT device required" +fi + +_scratch_mkfs >> $seqres.full 2>&1 + +echo "Dumping superblock using xfs_db without rtdev" +$XFS_DB_PROG $SCRATCH_DEV -c 'sb 0' -c 'p' >> $seqres.full + +echo "Loading RT superblock using xfs_db without rtdev, should fail" +$XFS_DB_PROG $SCRATCH_DEV -c 'rtsb' + +echo "Running xfs_repair -n without rt device, should fail" +$XFS_REPAIR_PROG -n $SCRATCH_DEV + +echo "Running xfs_repair without rt device, should fail" +$XFS_REPAIR_PROG $SCRATCH_DEV + + +status=0 +exittests/xfs/2300.out new file +14
-0@@ -0,0 +1,14 @@ +QA output created by 2300 +Dumping superblock using xfs_db without rtdev +Loading RT superblock using xfs_db without rtdev, should fail +realtime device not loaded, use -R. +Running xfs_repair -n without rt device, should fail +Phase 1 - find and verify superblock... +xfs_repair: filesystem has a realtime subvolume +xfs_repair: realtime device init failed +xfs_repair: cannot repair this filesystem. Sorry. +Running xfs_repair without rt device, should fail +Phase 1 - find and verify superblock... +xfs_repair: filesystem has a realtime subvolume +xfs_repair: realtime device init failed +xfs_repair: cannot repair this filesystem. Sorry.Signature · 1 line
2.53.0
Quoted 30 lines · Christoph Hellwig
Test that libxfs rejects initializing a file systems unless in debugger mode by running
xfs_repairandxfs_dbwith missing arguments. For db additionally test that command that require a RT device still do not work even after libxfs can be initialized using a missing RT device.Signed-off-by Christoph Hellwig <[email protected]>--- tests/xfs/2300 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/2300.out | 14 ++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 tests/xfs/2300 create mode 100644 tests/xfs/2300.outtests/xfs/2300 new file +11
-0@@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2026 Christoph Hellwig. +# +# FS QA Test No. 2300 +# +# Tests that repair refuses to work without -r argument, and xfs_db works fine +# even without it to check libxfs initialization behavior with missing RT +# devices. +# +. ./common/preamble
tests/xfs/2300 line 21
Quoted 10 lines
tests/xfs/2300 new file +10
-0+_begin_fstest auto quick repair db + +. ./common/filter + +_require_scratch_nocheck +_require_realtime + +if [ -z "$SCRATCH_RTDEV" ]; then + _notrun "external RT device required" +fi
I think "_require_realtime -> _require_external_realtime_device" already covers the "_notrun" above. I'll help to remove above redundant code when merging.
Quoted 8 lines
tests/xfs/2300 new file +8
-0+ +_scratch_mkfs >> $seqres.full 2>&1 + +echo "Dumping superblock using xfs_db without rtdev" +$XFS_DB_PROG $SCRATCH_DEV -c 'sb 0' -c 'p' >> $seqres.full + +echo "Loading RT superblock using xfs_db without rtdev, should fail" +$XFS_DB_PROG $SCRATCH_DEV -c 'rtsb'
tests/xfs/2300 line 39
Quoted 10 lines
tests/xfs/2300 new file +10
-0+ +echo "Running xfs_repair -n without rt device, should fail" +$XFS_REPAIR_PROG -n $SCRATCH_DEV + +echo "Running xfs_repair without rt device, should fail" +$XFS_REPAIR_PROG $SCRATCH_DEV + + +status=0 +exit
_exit 0
I'll remove the extra blank line above.
Others look good to me, thanks!
Quoted 23 lines
tests/xfs/2300.out new file +14
-0@@ -0,0 +1,14 @@ +QA output created by 2300 +Dumping superblock using xfs_db without rtdev +Loading RT superblock using xfs_db without rtdev, should fail +realtime device not loaded, use -R. +Running xfs_repair -n without rt device, should fail +Phase 1 - find and verify superblock... +xfs_repair: filesystem has a realtime subvolume +xfs_repair: realtime device init failed +xfs_repair: cannot repair this filesystem. Sorry. +Running xfs_repair without rt device, should fail +Phase 1 - find and verify superblock... +xfs_repair: filesystem has a realtime subvolume +xfs_repair: realtime device init failed +xfs_repair: cannot repair this filesystem. Sorry.Signature · 1 line
2.53.0
Quoted 9 lines · Zorro Lang
tests/xfs/2300 line 21
Quoted 6 lines
tests/xfs/2300 new file +6
-0+_require_scratch_nocheck +_require_realtime + +if [ -z "$SCRATCH_RTDEV" ]; then + _notrun "external RT device required" +fiI think "
_require_realtime->_require_external_realtime_device" already covers the "_notrun" above. I'll help to remove above redundant code when merging.
Yeah, _require_external_realtime_device would be better here.
FYI, Sashiko complained that this might break when using external log devices. I'll give that a try and will most like respin for that.
Quoted 2 lines · Christoph Hellwig
FYI, Sashiko complained that this might break when using external log devices. I'll give that a try and will most like respin for that.
Sure, I'll drop this one, wait the next version :)