From 0a014baacc4c2a56728a94c6da272febccc1cceb Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 8 May 2025 07:34:40 +0200 Subject: [PATCH] xfs: test zoned ENOSPC behavior with multiple writers Test that multiple parallel writers can't accidentally dip into the reserved space pool. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- tests/xfs/642 | 85 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/642.out | 2 ++ 2 files changed, 87 insertions(+) create mode 100755 tests/xfs/642 create mode 100644 tests/xfs/642.out diff --git a/tests/xfs/642 b/tests/xfs/642 new file mode 100755 index 00000000..c5e51e5b --- /dev/null +++ b/tests/xfs/642 @@ -0,0 +1,85 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Christoph Hellwig. +# +# FS QA Test No. 642 +# +# Test that multiple parallel writers can't accidentally dip into the reserved +# space pool. +# +. ./common/preamble +_begin_fstest quick auto rw zone enospc + +. ./common/filter +. ./common/zoned + +_require_scratch +_require_odirect +_require_aio + +_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 <&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/642.out b/tests/xfs/642.out new file mode 100644 index 00000000..e6b19b96 --- /dev/null +++ b/tests/xfs/642.out @@ -0,0 +1,2 @@ +QA output created by 642 +file space usage is in range -- 2.47.3