[PATCH v1 4/7] xfs: Add multi rt group grow + shutdown + recovery tests

Nirjhar Roy (IBM)
2026-02-19T06:11:59Z

From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>

This test repeatedly grows the realtime, then shuts down the filesystem
and checks that recovery works fine - this is similar to what is
already being done in xfs/609 but this tests with realtime XFS.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
tests/xfs/654 | 90 +++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/654.out | 5 +++
2 files changed, 95 insertions(+)
create mode 100755 tests/xfs/654
create mode 100644 tests/xfs/654.out

diff --git a/tests/xfs/654 b/tests/xfs/654
new file mode 100755
index 00000000..b5111e18
--- /dev/null
+++ b/tests/xfs/654
@@ -0,0 +1,90 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>. All Rights Reserved.
+#
+# FS QA Test 654
+#
+# Test XFS online growfs log recover with growing the realtime filesystem
+#
+. ./common/preamble
+_begin_fstest auto growfs stress shutdown log recoveryloop shrinkfs
+
+# Import common functions.
+. ./common/filter
+
+_stress_scratch()
+{
+ procs=4
+ nops=999
+ # -w ensures that the only ops are ones which cause write I/O
+ FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
+ -n $nops`
+ _run_fsstress_bg $FSSTRESS_ARGS >> $seqres.full 2>&1
+}
+FSSIZE=$(( 2 * 1024 * 1024 * 1024 )) # 2G
+_require_realtime_xfs_grow
+_require_scratch_size $((FSSIZE / 1024)) #KB
+_require_command "$XFS_GROWFS_PROG" xfs_growfs
+
+_fixed_by_kernel_commit a65fd8120766 "xfs: Fix xfs_grow_last_rtg()"
+_fixed_by_kernel_commit xxxxxxxxxxxx "xfs: Fix in xfs_rtalloc_query_range()"
+
+_scratch_mkfs_xfs | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+. $tmp.mkfs
+
+endsize=`expr 1024 \* 1048576` # stop after shrinking 512M size
+[ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
+
+nrgs=8
+nags="$nrgs"
+# We want to test with and without stress.
+for stress in 0 1
+do
+ for metadir in 0 1
+ do
+ size=`expr 512 \* 1048576` # 512 megabytes initially
+ sizeb=`expr $size / $dbsize` # in data blocks
+ _scratch_mkfs_xfs -bsize=4k -dsize=${size} -dagcount=${nags} -rsize=${size} \
+ -mmetadir="$metadir" -rrgcount=${nrgs} >> $seqres.full 2>&1 || _fail "mkfs failed"
+ _scratch_mount
+
+ $XFS_INFO_PROG $SCRATCH_MNT 2>&1 | _filter_mkfs 2>$tmp.xfsinfo >/dev/null
+ . $tmp.xfsinfo
+
+ if [[ "$stress" -eq 1 ]]; then
+ echo -n "Testing with stress "
+ else
+ echo -n "Testing without stress "
+ fi
+
+ echo -n "with -m metadir=$metadir "
+ # Grow the filesystem in random sized chunks while performing shutdown and
+ # recovery. The randomization is intended to create a mix of sub-rtg and
+ # multi-rtg shrinks.
+
+ while [ $size -le $endsize ]; do
+ echo "*** growing a ${sizeb} block filesystem " >> \
+ $seqres.full
+ if [[ "$stress" -eq 1 ]]; then
+ _stress_scratch
+ fi
+
+ incsize=$((RANDOM % 40 * 1048576))
+ size=`expr $size + $incsize`
+ sizeb=`expr $size / $dbsize`
+ $XFS_GROWFS_PROG -R ${sizeb} $SCRATCH_MNT >> $seqres.full 2>&1
+
+ sleep $((RANDOM % 3))
+ _scratch_shutdown
+ if [[ "$stress" -eq 1 ]]; then
+ _kill_fsstress
+ fi
+ _scratch_cycle_mount
+ done > /dev/null 2>&1
+ wait
+ _scratch_unmount
+ echo "succeeded"
+ done
+done
+
+_exit 0
diff --git a/tests/xfs/654.out b/tests/xfs/654.out
new file mode 100644
index 00000000..9bb5cb21
--- /dev/null
+++ b/tests/xfs/654.out
@@ -0,0 +1,5 @@
+QA output created by 654
+Testing without stress with -m metadir=0 succeeded
+Testing without stress with -m metadir=1 succeeded
+Testing with stress with -m metadir=0 succeeded
+Testing with stress with -m metadir=1 succeeded
--
2.34.1