public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: add a test that zoned file systems with rump RTG can't be mounted
@ 2025-12-10 14:23 Christoph Hellwig
  2025-12-10 16:50 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2025-12-10 14:23 UTC (permalink / raw)
  To: zlang; +Cc: djwong, fstests, linux-xfs

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

diff --git a/tests/xfs/651 b/tests/xfs/651
new file mode 100755
index 000000000000..3aef7a1d016f
--- /dev/null
+++ b/tests/xfs/651
@@ -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
diff --git a/tests/xfs/651.out b/tests/xfs/651.out
new file mode 100644
index 000000000000..62617d172811
--- /dev/null
+++ b/tests/xfs/651.out
@@ -0,0 +1,2 @@
+QA output created by 651
+Can't mount rump RTG file system
-- 
2.47.3


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

* Re: [PATCH] xfs: add a test that zoned file systems with rump RTG can't be mounted
  2025-12-10 14:23 [PATCH] xfs: add a test that zoned file systems with rump RTG can't be mounted Christoph Hellwig
@ 2025-12-10 16:50 ` Darrick J. Wong
  2025-12-10 16:57   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2025-12-10 16:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs

On Wed, Dec 10, 2025 at 03:23:30PM +0100, Christoph Hellwig wrote:
> 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>
> ---
>  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
> 
> diff --git a/tests/xfs/651 b/tests/xfs/651
> new file mode 100755
> index 000000000000..3aef7a1d016f
> --- /dev/null
> +++ b/tests/xfs/651
> @@ -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="$(_scratch_xfs_get_metadata_field rblocks 'sb 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

> +
> +# for non-zoned file systems this can succeed
> +_require_xfs_scratch_zoned
> +
> +status=0
> +exit
> diff --git a/tests/xfs/651.out b/tests/xfs/651.out
> new file mode 100644
> index 000000000000..62617d172811
> --- /dev/null
> +++ b/tests/xfs/651.out
> @@ -0,0 +1,2 @@
> +QA output created by 651
> +Can't mount rump RTG file system
> -- 
> 2.47.3
> 
> 

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

* Re: [PATCH] xfs: add a test that zoned file systems with rump RTG can't be mounted
  2025-12-10 16:50 ` Darrick J. Wong
@ 2025-12-10 16:57   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-12-10 16:57 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests, linux-xfs

On Wed, Dec 10, 2025 at 08:50:28AM -0800, Darrick J. Wong wrote:
> > +_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.

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


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

end of thread, other threads:[~2025-12-10 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 14:23 [PATCH] xfs: add a test that zoned file systems with rump RTG can't be mounted Christoph Hellwig
2025-12-10 16:50 ` Darrick J. Wong
2025-12-10 16:57   ` Christoph Hellwig

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