[PATCH 10/15] xfs: test zoned ENOSPC behavior with multiple writers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Test that multiple parallel writers can't accidentally dip into the reserved
space pool.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 tests/xfs/4209     | 90 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/4209.out |  2 ++
 2 files changed, 92 insertions(+)
 create mode 100755 tests/xfs/4209
 create mode 100644 tests/xfs/4209.out

diff --git a/tests/xfs/4209 b/tests/xfs/4209
new file mode 100755
index 000000000000..18c84a968c40
--- /dev/null
+++ b/tests/xfs/4209
@@ -0,0 +1,90 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Christoph Hellwig.
+#
+# FS QA Test No. 4209
+#
+# Test that multiple parallel writers can't accidentally dip into the reserved
+# space pool.
+#
+. ./common/preamble
+_begin_fstest quick auto rw zone enospc
+
+_cleanup()
+{
+	cd /
+	_scratch_unmount >/dev/null 2>&1
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/zoned
+
+_require_scratch
+
+_scratch_mkfs_sized $((256 * 1024 * 1024))  >>$seqres.full 2>&1
+
+# limit to two max open zones so that all writes get thrown into the blender
+export MOUNT_OPTIONS="$MOUNT_OPTIONS -o max_open_zones=2"
+_try_scratch_mount || _notrun "mount option not supported"
+_require_xfs_scratch_zoned
+
+fio_config=$tmp.fio
+
+cat >$fio_config <<EOF
+[global]
+bs=64k
+iodepth=16
+iodepth_batch=8
+directory=$SCRATCH_MNT
+ioengine=libaio
+rw=write
+direct=1
+size=60m
+
+[file1]
+filename=file1
+
+[file2]
+filename=file2
+
+[file3]
+filename=file3
+
+[file4]
+filename=file4
+
+[file5]
+filename=file5
+
+[file6]
+filename=file6
+
+[file7]
+filename=file7
+
+[file8]
+filename=file8
+EOF
+
+_require_fio $fio_config
+
+# try to overfill the file system
+$FIO_PROG $fio_config 2>&1 | \
+	grep -q "No space left on dev" || \
+	_fail "Overfill did not cause ENOSPC"
+
+sync
+
+#
+# Compare the df and du values to ensure we did not overshoot
+#
+# Use within_tolerance to paper over the fact that the du output includes
+# the root inode, which does not sit in the RT device, while df does not
+#
+df_val=`df --output=size $SCRATCH_MNT | tail -n 1`
+du_val=`du -s $SCRATCH_MNT | awk '{print $1}'`
+_within_tolerance "file space usage" $df_val $du_val 64 -v
+
+status=0
+exit
diff --git a/tests/xfs/4209.out b/tests/xfs/4209.out
new file mode 100644
index 000000000000..cb72138a1bf6
--- /dev/null
+++ b/tests/xfs/4209.out
@@ -0,0 +1,2 @@
+QA output created by 4209
+file space usage is in range
-- 
2.47.2





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux