* [PATCH v2] generic: test that fsync on zoned doesn't fail with -EAGAIN
@ 2026-11-17 6:58 Johannes Thumshirn
2026-11-20 15:45 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Thumshirn @ 2026-11-17 6:58 UTC (permalink / raw)
To: Zorro Lang; +Cc: linux-btrfs, Christoph Hellwig, fstests, Johannes Thumshirn
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
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] generic: test that fsync on zoned doesn't fail with -EAGAIN
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
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-11-20 15:45 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: Zorro Lang, linux-btrfs, Christoph Hellwig, fstests
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 15:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox