]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
scrub: race metapath online fsck with fsstress
authorDarrick J. Wong <djwong@kernel.org>
Thu, 20 Feb 2025 21:47:04 +0000 (13:47 -0800)
committerZorro Lang <zlang@kernel.org>
Thu, 6 Mar 2025 13:25:55 +0000 (21:25 +0800)
Add a pair of new tests to exercise fsstress vs. metapath repairs.

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

index 771ef90633c6dedc492caa0c5a9efd7f0fa4306d..c8f2ea241a2a41e42a02fc81d54b903ff4516297 100644 (file)
@@ -1658,6 +1658,9 @@ _xfs_filter_mkfs()
        if (/^realtime\s+=([\w|\/.-]+)\s+extsz=(\d+)\s+blocks=(\d+), rtextents=(\d+)/) {
                print STDERR "rtdev=$1\nrtextsz=$2\nrtblocks=$3\nrtextents=$4\n";
                print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n";
+       }
+       if (/^\s+=\s+rgcount=(\d+)\s+rgsize=(\d+) extents/) {
+               print STDERR "rgcount=$1\nrgextents=$2\n";
        }'
 }
 
diff --git a/tests/xfs/815 b/tests/xfs/815
new file mode 100755 (executable)
index 0000000..1687ea3
--- /dev/null
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024-2025 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 815
+#
+# Race fsstress and metadata directory tree path corruption detector for a
+# while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub fsstress_scrub
+
+_cleanup() {
+       _scratch_xfs_stress_scrub_cleanup &> /dev/null
+       cd /
+       rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+_scratch_mount
+
+verbs=()
+
+try_verb()
+{
+       $XFS_IO_PROG -x -c "scrub metapath $*" "$SCRATCH_MNT" 2>&1
+}
+
+# Metapath verbs that don't require arguments
+for v in quotadir usrquota grpquota prjquota rtdir; do
+       testio=$(try_verb "$v")
+       test -z "$testio" && verbs+=("$v")
+done
+
+# Metapath verbs that take a rt group number
+for ((rgno = 0; rgno < rgcount; rgno++)); do
+       for v in rtbitmap rtsummary rtrmapbt rtrefcbt; do
+               testio=$(try_verb "$v" "$rgno")
+               test -z "$testio" && verbs+=("$v $rgno")
+       done
+done
+test "${#verbs[@]}" -gt 0 || _notrun "no metapath verbs detected"
+
+args=()
+for v in "${verbs[@]}"; do
+       args+=("scrub metapath $v")
+done
+
+echo "${verbs[@]}" >> $seqres.full
+_scratch_xfs_stress_scrub "${args[@]}"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/815.out b/tests/xfs/815.out
new file mode 100644 (file)
index 0000000..6ea462f
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 815
+Silence is golden
diff --git a/tests/xfs/816 b/tests/xfs/816
new file mode 100755 (executable)
index 0000000..76bc44f
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024-2025 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 816
+#
+# Race fsstress and metadata directory tree path repair for a while to see if
+# we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair fsstress_online_repair
+
+_cleanup() {
+       _scratch_xfs_stress_scrub_cleanup &> /dev/null
+       cd /
+       rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+_scratch_mount
+
+verbs=()
+
+try_verb()
+{
+       $XFS_IO_PROG -x -c "repair metapath $*" "$SCRATCH_MNT" 2>&1 | \
+               sed -e '/did not need repair/d'
+}
+
+# Metapath verbs that don't require arguments
+for v in quotadir usrquota grpquota prjquota rtdir; do
+       testio=$(try_verb "$v")
+       test -z "$testio" && verbs+=("$v")
+done
+
+# Metapath verbs that take a rt group number
+for ((rgno = 0; rgno < rgcount; rgno++)); do
+       for v in rtbitmap rtsummary; do
+               testio=$(try_verb "$v" "$rgno")
+               test -z "$testio" && verbs+=("$v $rgno")
+       done
+done
+test "${#verbs[@]}" -gt 0 || _notrun "no metapath verbs detected"
+
+args=()
+for v in "${verbs[@]}"; do
+       args+=("repair metapath $v")
+done
+
+echo "${verbs[@]}" >> $seqres.full
+_scratch_xfs_stress_online_repair "${args[@]}"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/816.out b/tests/xfs/816.out
new file mode 100644 (file)
index 0000000..a9d8f94
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 816
+Silence is golden