FS/XFS testing framework
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: zlang@kernel.org
Cc: djwong@kernel.org, fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH] xfs: test libxfs handling of missing RT devices
Date: Mon, 14 Sep 2026 13:36:34 +0200	[thread overview]
Message-ID: <20260914113634.2448723-1-hch@lst.de> (raw)

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


             reply	other threads:[~2026-09-14 11:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 11:36 Christoph Hellwig [this message]
2026-09-14 15:05 ` [PATCH] xfs: test libxfs handling of missing RT devices Darrick J. Wong
2026-09-15  6:22   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2026-09-25  5:15 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260914113634.2448723-1-hch@lst.de \
    --to=hch@lst.de \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox