]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: test that RT growfs not aligned to zone size fails
authorChristoph Hellwig <hch@lst.de>
Fri, 19 Dec 2025 05:35:45 +0000 (06:35 +0100)
committerZorro Lang <zlang@kernel.org>
Wed, 31 Dec 2025 20:59:50 +0000 (04:59 +0800)
Check that a file system with a zoned RT subvolume can't be resized to
a size not aligned to the zone size.

Uses a zloop device so that we can control the exact zone size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/xfs/652 [new file with mode: 0755]
tests/xfs/652.out [new file with mode: 0644]

diff --git a/tests/xfs/652 b/tests/xfs/652
new file mode 100755 (executable)
index 0000000..91399be
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2025 Christoph Hellwig.
+#
+# FS QA Test No. 652
+#
+# Tests that xfs_growfs to a realtime volume size that is not zone aligned is
+# rejected.
+#
+. ./common/preamble
+_begin_fstest auto quick realtime growfs zone
+
+. ./common/filter
+. ./common/zoned
+
+_require_realtime
+_require_zloop
+_require_scratch
+_require_scratch_size $((16 * 1024 * 1024)) # 16GiB in kiB units
+
+_cleanup()
+{
+       if [ -n "$mnt" ]; then
+               _unmount $mnt 2>/dev/null
+       fi
+       _destroy_zloop $zloop
+       cd /
+       rm -r -f $tmp.*
+}
+
+_scratch_mkfs > /dev/null 2>&1
+_scratch_mount
+
+fsbsize=4096
+unaligned_size=$((((12 * 1024 * 1024 * 1024) + (fsbsize * 13)) / fsbsize))
+
+mnt="$SCRATCH_MNT/mnt"
+zloopdir="$SCRATCH_MNT/zloop"
+
+mkdir -p $mnt
+zloop=$(_create_zloop $zloopdir 256 2)
+
+echo "Format and mount zloop file system"
+_try_mkfs_dev -b size=4k -r size=10g $zloop >> $seqres.full 2>&1 ||\
+       _notrun "cannot mkfs zoned filesystem"
+_mount $zloop $mnt
+
+echo "Try to grow file system to a not zone aligned size"
+$XFS_GROWFS_PROG -R $unaligned_size $mnt >> $seqres.full 2>&1 && \
+       _fail "growfs to unaligned size succeeded"
+
+echo "Remount file system"
+umount $mnt
+_mount $zloop $mnt
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/652.out b/tests/xfs/652.out
new file mode 100644 (file)
index 0000000..8de9ab4
--- /dev/null
@@ -0,0 +1,4 @@
+QA output created by 652
+Format and mount zloop file system
+Try to grow file system to a not zone aligned size
+Remount file system