public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: zlang@kernel.org, hans.holmberg@wdc.com,
	linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH] xfs: test zone reset error handling
Date: Tue, 27 Jan 2026 17:42:55 -0800	[thread overview]
Message-ID: <20260128014255.GK5945@frogsfrogsfrogs> (raw)
In-Reply-To: <20260127160906.330682-1-hch@lst.de>

On Tue, Jan 27, 2026 at 05:09:06PM +0100, Christoph Hellwig wrote:
> Add a test that exercises the zone gc error handling, aka shutting
> down the file system or not mounting it using the new error
> injection knob and stats.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/xfs/842     | 63 +++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/842.out |  2 ++
>  2 files changed, 65 insertions(+)
>  create mode 100755 tests/xfs/842
>  create mode 100644 tests/xfs/842.out
> 
> diff --git a/tests/xfs/842 b/tests/xfs/842
> new file mode 100755
> index 000000000000..8f6c13f1b19c
> --- /dev/null
> +++ b/tests/xfs/842
> @@ -0,0 +1,63 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 Christoph Hellwig.
> +#
> +# FS QA Test No. 842
> +#
> +# Test that GC defragments sequentially written files.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick mount zone
> +
> +. ./common/filter
> +. ./common/zoned
> +
> +_require_scratch
> +_require_fs_sysfs stats/stats
> +
> +count_zone_resets() {
> +	_get_fs_sysfs_attr $SCRATCH_DEV stats/stats | awk '/zoned/ {print $4}'
> +}
> +
> +_scratch_mkfs >>$seqres.full 2>&1
> +
> +# figure out how much space we need for 3 zones worth of user data...
> +blocksize=`_scratch_xfs_get_sb_field blocksize`
> +rgblocks=`_scratch_xfs_get_sb_field rgextents`
> +rgsize=$((3 * rgblocks * blocksize))
> +echo "blocksize=${blocksize}, rgblocks=${rgblocks}, rgsize=${rgsize}" >>$seqres.full 2>&1
> +
> +# .. and create a file system with that size
> +_scratch_mkfs_sized $rgsize >>$seqres.full 2>&1
> +
> +SAVED_MOUNT_OPTIONS="$MOUNT_OPTIONS"
> +export MOUNT_OPTIONS="$MOUNT_OPTIONS -o errortag=zone_reset"
> +_try_scratch_mount || _notrun "mount option not supported"
> +_require_xfs_scratch_zoned
> +
> +# fill the file system and remove the data again, this should trigger zone
> +# resets that will fail due to the error detection
> +dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M >/dev/null 2>&1
> +sync $SCRATCH_MNT
> +rm $SCRATCH_MNT/foo
> +sync $SCRATCH_MNT
> +sleep 1
> +
> +touch $SCRATCH_MNT/bar 2>/dev/null && _fail "file system not shutdown"
> +
> +# unmount the shutdown file system
> +_scratch_unmount
> +
> +# try mounting with error injection still enabled.  This should fail.
> +_try_scratch_mount && _fail "file system mounted despite zone reset errors"

Is it necessary to _fail here explicitly?  Or could you just echo that
string and let the golden output disturbance cause the test to fail?

--D

> +# now try without the error injection
> +MOUNT_OPTIONS="$SAVED_MOUNT_OPTIONS"
> +_scratch_mount
> +
> +# all three zones should be reset on mount
> +nr_resets=$(count_zone_resets)
> +echo "zone resets: $nr_resets"
> +
> +status=0
> +exit
> diff --git a/tests/xfs/842.out b/tests/xfs/842.out
> new file mode 100644
> index 000000000000..718805b5766e
> --- /dev/null
> +++ b/tests/xfs/842.out
> @@ -0,0 +1,2 @@
> +QA output created by 842
> +zone resets: 3
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2026-01-28  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 16:09 [PATCH] xfs: test zone reset error handling Christoph Hellwig
2026-01-28  1:42 ` Darrick J. Wong [this message]
2026-01-28  3:38   ` Christoph Hellwig
2026-01-28  5:05     ` Darrick J. Wong

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=20260128014255.GK5945@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --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