From: Zorro Lang <zlang@kernel.org>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: linux-btrfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
fstests@vger.kernel.org
Subject: Re: [PATCH v2] generic: test that fsync on zoned doesn't fail with -EAGAIN
Date: Sat, 21 Nov 2026 20:10:35 +0800 [thread overview]
Message-ID: <awGKG7Z5XBiqzxdu@zlang-mailbox> (raw)
In-Reply-To: <20261117065848.3825371-1-johannes.thumshirn@wdc.com>
On Tue, Nov 17, 2026 at 07:58:48AM +0100, Johannes Thumshirn wrote:
> On a zoned btrfs, btrfs_start_transaction() forces a transaction commit
> when the delayed refs reservation exceeds its zoned cap. If the cap is
> still exceeded after the commit, it returned -EAGAIN, which fsync passed
> on to user space.
>
> Run parallel writers creating, overwriting and deleting small files with
> an fsync after every write on a zoned device with a limited number of
> active zones, and check that no fsync fails.
>
> Assisted-by: LLM
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> Changes to v1:
> - Move to a generic test
Thanks for this update.
Reviewed-by: Zorro Lang <zlang@kernel.org>
>
> tests/generic/814 | 83 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/814.out | 2 ++
> 2 files changed, 85 insertions(+)
> create mode 100755 tests/generic/814
> create mode 100644 tests/generic/814.out
>
> diff --git a/tests/generic/814 b/tests/generic/814
> new file mode 100755
> index 00000000..316925c1
> --- /dev/null
> +++ b/tests/generic/814
> @@ -0,0 +1,83 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 Western Digital Corporation. All Rights Reserved.
> +#
> +# FS QA Test 814
> +#
> +. ./common/preamble
> +_begin_fstest auto quick zone
> +
> +_cleanup()
> +{
> + cd /
> + [ -n "$pids" ] && kill $pids &> /dev/null
> + wait
> + rm -r -f $tmp.*
> +}
> +
> +. ./common/zoned
> +
> +_fixed_by_fs_commit btrfs XXXXXXXXXXXX \
> + "btrfs: zoned: don't fail start_transaction() after a forced commit"
> +
> +_require_scratch_size $((4 * 1024 * 1024)) # kB
> +
> +if [ -b "$SCRATCH_RTDEV" ]; then
> + zoned_dev=$SCRATCH_RTDEV
> +else
> + zoned_dev=$SCRATCH_DEV
> +fi
> +
> +_require_zoned_device "$zoned_dev"
> +_require_limited_active_zones "$zoned_dev"
> +
> +nr_writers=$((8 * LOAD_FACTOR))
> +nr_files=250
> +nr_rounds=$((4 * TIME_FACTOR))
> +
> +_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
> +_scratch_mount
> +
> +# Every other file is deleted per round to churn data and metadata.
> +writer()
> +{
> + local dir=$SCRATCH_MNT/w$1
> + local r i sz
> +
> + mkdir -p $dir
> + for r in $(seq $nr_rounds); do
> + for i in $(seq $nr_files); do
> + # 4K - 256K
> + sz=$(( ((i + r + $1) % 64 + 1) * 4096 ))
> + $XFS_IO_PROG -f -c "pwrite -q -S $i -b 64k 0 $sz" \
> + -c fsync $dir/$i || return 1
> + done
> + for i in $(seq 1 2 $nr_files); do
> + rm -f $dir/$i
> + done
> + done
> +}
> +
> +pids=""
> +for w in $(seq $nr_writers); do
> + writer $w > $tmp.writer.$w 2>&1 &
> + pids="$pids $!"
> +done
> +
> +ret=0
> +for p in $pids; do
> + wait $p || ret=1
> +done
> +unset pids
> +cat $tmp.writer.* >> $seqres.full
> +[ $ret -eq 0 ] || echo "writer failed, see $seqres.full"
> +
> +find $SCRATCH_MNT -type f | sort | xargs md5sum > $tmp.md5.before
> +_scratch_cycle_mount
> +find $SCRATCH_MNT -type f | sort | xargs md5sum > $tmp.md5.after
> +diff -q $tmp.md5.before $tmp.md5.after > /dev/null || echo "data mismatch"
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +_exit 0
> diff --git a/tests/generic/814.out b/tests/generic/814.out
> new file mode 100644
> index 00000000..95532d3d
> --- /dev/null
> +++ b/tests/generic/814.out
> @@ -0,0 +1,2 @@
> +QA output created by 814
> +Silence is golden
> --
> 2.56.1
>
prev parent reply other threads:[~2026-11-21 12:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:58 [PATCH v2] generic: test that fsync on zoned doesn't fail with -EAGAIN Johannes Thumshirn
2026-11-20 15:45 ` Christoph Hellwig
2026-11-21 12:10 ` Zorro Lang [this message]
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=awGKG7Z5XBiqzxdu@zlang-mailbox \
--to=zlang@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-btrfs@vger.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