Test for a problem with an earlier version of the zoned XFS mount code where freeded blocks in an open zone weren't properly accounted for. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- tests/xfs/4201 | 47 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/4201.out | 6 ++++++ 2 files changed, 53 insertions(+) create mode 100755 tests/xfs/4201 create mode 100644 tests/xfs/4201.out diff --git a/tests/xfs/4201 b/tests/xfs/4201 new file mode 100755 index 000000000000..5367291f3e87 --- /dev/null +++ b/tests/xfs/4201 @@ -0,0 +1,47 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Christoph Hellwig. +# +# FS QA Test No. 4201 +# +# Regression test for mount time accounting of an open zone with freed blocks. +# + +. ./common/preamble +_begin_fstest auto quick zone + +_require_scratch +_require_odirect + +tmp=`mktemp -d` + +_cleanup() +{ + rm -rf $tmp +} + +# +# Create a 256MB file system. This is picked as the lowest common zone size +# to ensure both files are placed into the same zone. +# +_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount + +dd if=/dev/zero of=$SCRATCH_MNT/test1 oflag=direct conv=fsync bs=1M count=32 +dd if=/dev/zero of=$SCRATCH_MNT/test2 oflag=direct conv=fsync bs=1M count=32 +rm $SCRATCH_MNT/test1 + +# let delayed inode deactivate do its work +sleep 1 +df -h $SCRATCH_MNT > $tmp/df.old + +_scratch_cycle_mount + +echo "Check that df output matches after remount" +df -h $SCRATCH_MNT > $tmp/df.new +diff -u $tmp/df.old $tmp/df.new + +_scratch_unmount + +status=0 +exit diff --git a/tests/xfs/4201.out b/tests/xfs/4201.out new file mode 100644 index 000000000000..4cff86d90b0f --- /dev/null +++ b/tests/xfs/4201.out @@ -0,0 +1,6 @@ +QA output created by 4201 +32+0 records in +32+0 records out +32+0 records in +32+0 records out +Check that df output matches after remount -- 2.47.2