]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs: add a test for zoned block accounting after remount
authorChristoph Hellwig <hch@lst.de>
Tue, 22 Oct 2024 07:41:56 +0000 (09:41 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 5 Nov 2024 08:31:58 +0000 (09:31 +0100)
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@lst.de>
tests/xfs/4201 [new file with mode: 0755]
tests/xfs/4201.out [new file with mode: 0644]

diff --git a/tests/xfs/4201 b/tests/xfs/4201
new file mode 100755 (executable)
index 0000000..5367291
--- /dev/null
@@ -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 (file)
index 0000000..4cff86d
--- /dev/null
@@ -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