]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic: test premature ENOSPC in zoned garbage collection master v2026.04.20
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 15 Apr 2026 10:40:15 +0000 (12:40 +0200)
committerZorro Lang <zlang@kernel.org>
Thu, 16 Apr 2026 18:19:30 +0000 (02:19 +0800)
This test stresses garbage collection in zoned file systems by
constantly overwriting the same file. It is inspired by a reproducer
for a btrfs bugfix.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/793 [new file with mode: 0755]
tests/generic/793.out [new file with mode: 0644]

diff --git a/tests/generic/793 b/tests/generic/793
new file mode 100755 (executable)
index 0000000..a59e846
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Western Digital Corporation.  All Rights Reserved.
+#
+# FS QA Test No. 793
+#
+# This test stresses garbage collection in zoned file systems by constantly
+# overwriting the same file. It is inspired by a reproducer for a btrfs bugfix.
+
+. ./common/preamble
+_begin_fstest auto quick zone
+
+. ./common/filter
+
+_require_scratch_size $((16 * 1024 * 1024))
+
+if [ -b "$SCRATCH_RTDEV" ]; then
+       zoned_dev=$SCRATCH_RTDEV
+else
+       zoned_dev=$SCRATCH_DEV
+fi
+
+_require_zoned_device "$zoned_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 $zoned_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/793.out b/tests/generic/793.out
new file mode 100644 (file)
index 0000000..e8a17d4
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 793
+Silence is golden