public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] fstests: test premature ENOSPC in zoned garbage collection
@ 2026-04-14 14:33 Johannes Thumshirn
  2026-04-15  5:22 ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Thumshirn @ 2026-04-14 14:33 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Naohiro Aota, fstests, linux-btrfs, Christoph Hellwig,
	Johannes Thumshirn

This test stresses garbage collection in zoned file systems by
constantly overwriting the same file. It is inspired by a reproducer for
a btrfs bugifx.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
Changes to v1:
- Rebased onto patches-in-queue
- Use "generic/999" to avoid any conflicts
- Change the number of loops to number of seq zones
- Remove bogus "2>&1"
- This time really did it...

Link to v1:
https://lore.kernel.org/all/20260210111103.265664-1-johannes.thumshirn@wdc.com/
 tests/generic/999     | 46 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/999.out |  2 ++
 2 files changed, 48 insertions(+)
 create mode 100755 tests/generic/999
 create mode 100644 tests/generic/999.out

diff --git a/tests/generic/999 b/tests/generic/999
new file mode 100755
index 000000000000..ef2b63abefd7
--- /dev/null
+++ b/tests/generic/999
@@ -0,0 +1,46 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Western Digital Corporation.  All Rights Reserved.
+#
+# FS QA Test 999
+#
+# This test stresses garbage collection in zoned file systems by constantly
+# overwriting the same file. It is inspired by a reproducer for a btrfs bugifx.
+
+. ./common/preamble
+_begin_fstest auto quick zone
+
+. ./common/filter
+
+_require_scratch_size $((16 * 1024 * 1024))
+_require_zoned_device "$SCRATCH_DEV"
+_require_command "$BLKZONE_PROG" blkzone
+
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
+_fixed_by_fs_commit btrfs 7bcb04de982f \
+	"btrfs: zoned: cap delayed refs metadata reservation to avoid overcommit"
+_fixed_by_fs_commit btrfs 258e46a6385c \
+	"btrfs: zoned: move partially zone_unusable block groups to reclaim list"
+_fixed_by_fs_commit btrfs e2a7fd22378f \
+	"btrfs: zoned: add zone reclaim flush state for DATA space_info"
+
+_scratch_mkfs_sized $((16 * 1024 * 1024 * 1024)) &>>$seqres.full
+_scratch_mount
+
+# Overwrite the data "number of seq zones" times, this is arbitrarily chosen
+# but triggers the original bug reliably
+loops=$($BLKZONE_PROG report $SCRATCH_DEV | grep -c "SEQ_WRITE_REQUIRED")
+
+for (( i = 0; i < $loops; i++ )); do
+	dd if=/dev/zero of=$SCRATCH_MNT/test bs=1M count=1024 status=none
+	if [ $? -ne 0 ]; then
+		_fail "Failed writing on iteration $i"
+	fi
+done
+
+echo "Silence is golden"
+# success, all done
+_exit 0
diff --git a/tests/generic/999.out b/tests/generic/999.out
new file mode 100644
index 000000000000..3b276ca804fc
--- /dev/null
+++ b/tests/generic/999.out
@@ -0,0 +1,2 @@
+QA output created by 999
+Silence is golden
-- 
2.53.0


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

end of thread, other threads:[~2026-04-15  7:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 14:33 [PATCH v3] fstests: test premature ENOSPC in zoned garbage collection Johannes Thumshirn
2026-04-15  5:22 ` Christoph Hellwig
2026-04-15  5:53   ` Johannes Thumshirn
2026-04-15  5:56     ` Christoph Hellwig
2026-04-15  6:10       ` Johannes Thumshirn
2026-04-15  6:27         ` Christoph Hellwig
2026-04-15  6:53           ` Johannes Thumshirn
2026-04-15  7:04             ` Christoph Hellwig

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