Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs: test libxfs handling of missing RT devices
@ 2026-09-14 11:36 Christoph Hellwig
  2026-09-14 15:05 ` Darrick J. Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:36 UTC (permalink / raw)
  To: zlang; +Cc: djwong, fstests, linux-xfs

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/xfs/2300     | 48 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/2300.out | 14 ++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100755 tests/xfs/2300
 create mode 100644 tests/xfs/2300.out

diff --git a/tests/xfs/2300 b/tests/xfs/2300
new file mode 100755
index 000000000000..70c1d6bad9cc
--- /dev/null
+++ b/tests/xfs/2300
@@ -0,0 +1,48 @@
+#! /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
+
+_cleanup()
+{
+	_unmount $LOOP_MNT 2>/dev/null
+	[ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
+	rm -rf $LOOP_IMG $LOOP_MNT
+	cd /
+	rm -f $tmp.*
+}
+
+_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
diff --git a/tests/xfs/2300.out b/tests/xfs/2300.out
new file mode 100644
index 000000000000..50aab2b83ec9
--- /dev/null
+++ b/tests/xfs/2300.out
@@ -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.
-- 
2.53.0


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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-14 11:36 Christoph Hellwig
@ 2026-09-14 15:05 ` Darrick J. Wong
  2026-09-15  6:22   ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2026-09-14 15:05 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs

On Mon, Sep 14, 2026 at 01:36:34PM +0200, Christoph Hellwig wrote:
> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/xfs/2300     | 48 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/2300.out | 14 ++++++++++++++
>  2 files changed, 62 insertions(+)
>  create mode 100755 tests/xfs/2300
>  create mode 100644 tests/xfs/2300.out
> 
> diff --git a/tests/xfs/2300 b/tests/xfs/2300
> new file mode 100755
> index 000000000000..70c1d6bad9cc
> --- /dev/null
> +++ b/tests/xfs/2300
> @@ -0,0 +1,48 @@
> +#! /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
> +
> +_cleanup()
> +{
> +	_unmount $LOOP_MNT 2>/dev/null
> +	[ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
> +	rm -rf $LOOP_IMG $LOOP_MNT

I don't see any users of loop devices here?

Otherwise this test looks ok to me.

--D

> +	cd /
> +	rm -f $tmp.*
> +}
> +
> +_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
> diff --git a/tests/xfs/2300.out b/tests/xfs/2300.out
> new file mode 100644
> index 000000000000..50aab2b83ec9
> --- /dev/null
> +++ b/tests/xfs/2300.out
> @@ -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.
> -- 
> 2.53.0
> 
> 

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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-14 15:05 ` Darrick J. Wong
@ 2026-09-15  6:22   ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-09-15  6:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests, linux-xfs

On Mon, Sep 14, 2026 at 08:05:49AM -0700, Darrick J. Wong wrote:
> > +	_unmount $LOOP_MNT 2>/dev/null
> > +	[ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
> > +	rm -rf $LOOP_IMG $LOOP_MNT
> 
> I don't see any users of loop devices here?

Yeah.  I initially started writing it loop based but got fed up with
that and decided that we can just require an rt dev run for test
coverage..


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

* [PATCH] xfs: test libxfs handling of missing RT devices
@ 2026-09-25  5:15 Christoph Hellwig
  2026-09-25 19:47 ` Darrick J. Wong
  2026-09-27 12:20 ` Zorro Lang
  0 siblings, 2 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-09-25  5:15 UTC (permalink / raw)
  To: zlang; +Cc: djwong, fstests, linux-xfs

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.

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

diff --git a/tests/xfs/2300 b/tests/xfs/2300
new file mode 100755
index 000000000000..9d8bd9c6ae44
--- /dev/null
+++ b/tests/xfs/2300
@@ -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
diff --git a/tests/xfs/2300.out b/tests/xfs/2300.out
new file mode 100644
index 000000000000..50aab2b83ec9
--- /dev/null
+++ b/tests/xfs/2300.out
@@ -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.
-- 
2.53.0


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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-25  5:15 [PATCH] xfs: test libxfs handling of missing RT devices Christoph Hellwig
@ 2026-09-25 19:47 ` Darrick J. Wong
  2026-09-27 12:20 ` Zorro Lang
  1 sibling, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2026-09-25 19:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs

On Fri, Sep 25, 2026 at 07:15:15AM +0200, Christoph Hellwig wrote:
> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

--D

> ---
>  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
> 
> diff --git a/tests/xfs/2300 b/tests/xfs/2300
> new file mode 100755
> index 000000000000..9d8bd9c6ae44
> --- /dev/null
> +++ b/tests/xfs/2300
> @@ -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
> diff --git a/tests/xfs/2300.out b/tests/xfs/2300.out
> new file mode 100644
> index 000000000000..50aab2b83ec9
> --- /dev/null
> +++ b/tests/xfs/2300.out
> @@ -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.
> -- 
> 2.53.0
> 
> 

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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-25  5:15 [PATCH] xfs: test libxfs handling of missing RT devices Christoph Hellwig
  2026-09-25 19:47 ` Darrick J. Wong
@ 2026-09-27 12:20 ` Zorro Lang
  2026-09-28  5:35   ` Christoph Hellwig
  2026-09-28  6:58   ` Christoph Hellwig
  1 sibling, 2 replies; 9+ messages in thread
From: Zorro Lang @ 2026-09-27 12:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: djwong, fstests, linux-xfs

On Fri, Sep 25, 2026 at 07:15:15AM +0200, Christoph Hellwig wrote:
> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  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
> 
> diff --git a/tests/xfs/2300 b/tests/xfs/2300
> new file mode 100755
> index 000000000000..9d8bd9c6ae44
> --- /dev/null
> +++ b/tests/xfs/2300
> @@ -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

I think "_require_realtime -> _require_external_realtime_device" already covers
the "_notrun" above. I'll help to remove above redundant code when merging.

> +
> +_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

_exit 0

I'll remove the extra blank line above.

Others look good to me, thanks!

Reviewed-by: Zorro Lang <zlang@kernel.org>

> diff --git a/tests/xfs/2300.out b/tests/xfs/2300.out
> new file mode 100644
> index 000000000000..50aab2b83ec9
> --- /dev/null
> +++ b/tests/xfs/2300.out
> @@ -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.
> -- 
> 2.53.0
> 

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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-27 12:20 ` Zorro Lang
@ 2026-09-28  5:35   ` Christoph Hellwig
  2026-09-28  6:58   ` Christoph Hellwig
  1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-09-28  5:35 UTC (permalink / raw)
  To: djwong, fstests, linux-xfs

On Sun, Sep 27, 2026 at 08:20:12PM +0800, Zorro Lang wrote:
> > +_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.

Yeah, _require_external_realtime_device would be better here.


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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-27 12:20 ` Zorro Lang
  2026-09-28  5:35   ` Christoph Hellwig
@ 2026-09-28  6:58   ` Christoph Hellwig
  2026-09-28  9:56     ` Zorro Lang
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2026-09-28  6:58 UTC (permalink / raw)
  To: Christoph Hellwig, djwong, fstests, linux-xfs

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.


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

* Re: [PATCH] xfs: test libxfs handling of missing RT devices
  2026-09-28  6:58   ` Christoph Hellwig
@ 2026-09-28  9:56     ` Zorro Lang
  0 siblings, 0 replies; 9+ messages in thread
From: Zorro Lang @ 2026-09-28  9:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: djwong, fstests, linux-xfs

On Mon, Sep 28, 2026 at 08:58:16AM +0200, Christoph Hellwig wrote:
> 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 :)

> 
> 

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

end of thread, other threads:[~2026-09-28  9:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-25  5:15 [PATCH] xfs: test libxfs handling of missing RT devices Christoph Hellwig
2026-09-25 19:47 ` Darrick J. Wong
2026-09-27 12:20 ` Zorro Lang
2026-09-28  5:35   ` Christoph Hellwig
2026-09-28  6:58   ` Christoph Hellwig
2026-09-28  9:56     ` Zorro Lang
  -- strict thread matches above, loose matches on Subject: below --
2026-09-14 11:36 Christoph Hellwig
2026-09-14 15:05 ` Darrick J. Wong
2026-09-15  6:22   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox