Re: [PATCH] xfs/333: test zoned realtime writeback EIO shutdown
Zorro Lang <[email protected]>
| Newsgroups | org.kernel.vger.fstests,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <ai7LiV1TrX5D_E2J@zlang-mailbox> |
On Fri, Jun 12, 2026 at 03:42:31PM +0800, Yao Sang wrote: > Create a zoned realtime filesystem with a single user data open zone, > dirty one zone worth of data, and inject a writeback error on the > realtime device. > > After disabling fault injection, fsync a second write. The filesystem > must already be shut down so that the second fsync fails quickly instead > of waiting for zoned allocation progress. > > Signed-off-by: Yao Sang <[email protected]> > --- > This is a test for the XFS zoned writeback shutdown fix posted as: > https://lore.kernel.org/all/[email protected]/ > > Tested on a ZNS realtime XFS setup with fail_make_request enabled. The > test passes with the v2 XFS fix applied. On a kernel without that fix, > the second fsync waits behind the consumed open zone and reproduces the > hung writer condition. > > tests/xfs/333 | 69 +++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/333.out | 1 + > 2 files changed, 70 insertions(+) > create mode 100755 tests/xfs/333 > create mode 100644 tests/xfs/333.out > > diff --git a/tests/xfs/333 b/tests/xfs/333 > new file mode 100755 > index 00000000..aafee4c3 > --- /dev/null > +++ b/tests/xfs/333 > @@ -0,0 +1,69 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2026 Kylin Software. > +# > +# FS QA Test No. 333 > +# > +# Check that an unrecoverable writeback error on a zoned realtime device shuts > +# down the filesystem. > +# > +. ./common/preamble > +_begin_fstest auto quick rw zone eio > + > +. ./common/filter > +. ./common/fail_make_request > +. ./common/zoned > + > +_require_debugfs > +_require_scratch_nocheck > +_require_realtime > +_require_block_device $SCRATCH_RTDEV > +_require_zoned_device $SCRATCH_RTDEV > +_require_command "$BLKZONE_PROG" blkzone > +_require_fail_make_request > + > +_cleanup() > +{ > + [ -n "$SCRATCH_RTDEV" ] && \ > + _bdev_fail_make_request $SCRATCH_RTDEV 0 > /dev/null 2>&1 > + _disallow_fail_make_request > /dev/null 2>&1 > + _scratch_unmount > /dev/null 2>&1 > + cd / > + rm -r -f $tmp.* > +} > +_register_cleanup _cleanup ^^^^^^^^^^^^^^^^^ This line isn't necessary. Since "_register_cleanup _cleanup" is called in _begin_fstest, it only registers the function name (not function instance). The latest definition will be called automatically, so there's no need to worry. > + > +zone_capacity=$(_zone_capacity 0 $SCRATCH_RTDEV) > +echo "zone capacity: $zone_capacity" >> $seqres.full > + > +_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 > + > +# Leave only one open zone for user data. If writeback fails after consuming > +# it, further writers must either see shutdown or wait forever for zone space. > +export MOUNT_OPTIONS="$MOUNT_OPTIONS -o max_open_zones=2" > +_try_scratch_mount || _notrun "mount option not supported" > +_require_xfs_scratch_zoned 1 > + > +_prepare_for_eio_shutdown $SCRATCH_DEV ^^^^^^^^^^^^^^^^^^^^^^^^^ This line is already called in _try_scratch_mount, don't need to call it again, except you want to run it on another device. > + > +testfile=$SCRATCH_MNT/writeback-error > +waitfile=$SCRATCH_MNT/wait-for-zone > + > +$XFS_IO_PROG -f -c "pwrite -S 0x58 0 $zone_capacity" $testfile \ > + >> $seqres.full 2>&1 || _fail "failed to dirty test file" > + > +_allow_fail_make_request 100 100000 0 > /dev/null > +_bdev_fail_make_request $SCRATCH_RTDEV 1 > /dev/null > + > +$XFS_IO_PROG -c "fsync" $testfile >> $seqres.full 2>&1 && \ > + _fail "fsync succeeded despite realtime device error" > + > +_bdev_fail_make_request $SCRATCH_RTDEV 0 > /dev/null > +_disallow_fail_make_request > /dev/null > + > +$XFS_IO_PROG -f -c "pwrite -S 0x59 0 4k" -c "fsync" $waitfile \ > + >> $seqres.full 2>&1 && \ > + _fail "filesystem did not shut down after zoned writeback error" OK, others looks good to me. Since above changes are straightforward, if you don't have any other updates that require a V2, I can just remove those two redundant lines for you when merging. Reviewed-by: Zorro Lang <[email protected]> Thanks, Zorro > + > +status=0 > +exit > diff --git a/tests/xfs/333.out b/tests/xfs/333.out > new file mode 100644 > index 00000000..3e11d156 > --- /dev/null > +++ b/tests/xfs/333.out > @@ -0,0 +1 @@ > +QA output created by 333 > -- > 2.25.1 >