]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: stress test ag repair functions
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Dec 2022 22:19:12 +0000 (14:19 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 18 Feb 2023 06:35:46 +0000 (14:35 +0800)
Race fsstress and various AG repair functions.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
15 files changed:
common/fuzzy
tests/xfs/708 [new file with mode: 0755]
tests/xfs/708.out [new file with mode: 0644]
tests/xfs/709 [new file with mode: 0755]
tests/xfs/709.out [new file with mode: 0644]
tests/xfs/710 [new file with mode: 0755]
tests/xfs/710.out [new file with mode: 0644]
tests/xfs/711 [new file with mode: 0755]
tests/xfs/711.out [new file with mode: 0644]
tests/xfs/712 [new file with mode: 0755]
tests/xfs/712.out [new file with mode: 0644]
tests/xfs/713 [new file with mode: 0755]
tests/xfs/713.out [new file with mode: 0644]
tests/xfs/714 [new file with mode: 0755]
tests/xfs/714.out [new file with mode: 0644]

index cc775b62be57ab20a421d61361d000590ef43128..7d244cc1f21a4cdde65443fcca0ca5b2113db72e 100644 (file)
@@ -393,7 +393,8 @@ __stress_one_scrub_loop() {
        local runningfile="$2"
        local scrub_tgt="$3"
        local scrub_startat="$4"
-       shift; shift; shift; shift
+       local start_agno="$5"
+       shift; shift; shift; shift; shift
        local agcount="$(_xfs_mount_agcount $SCRATCH_MNT)"
 
        local xfs_io_args=()
@@ -403,7 +404,7 @@ __stress_one_scrub_loop() {
                fi
                if echo "$arg" | grep -q -w '%agno%'; then
                        # Substitute the AG number
-                       for ((agno = 0; agno < agcount; agno++)); do
+                       for ((agno = start_agno; agno < agcount; agno++)); do
                                local ag_arg="$(echo "$arg" | sed -e "s|%agno%|$agno|g")"
                                xfs_io_args+=('-c' "$ag_arg")
                        done
@@ -413,28 +414,34 @@ __stress_one_scrub_loop() {
        done
 
        local extra_filters=()
-       local target_cmd=(echo "$scrub_tgt")
        case "$scrub_tgt" in
        "%file%"|"%datafile%"|"%attrfile%")
                extra_filters+=('No such file or directory' 'No such device or address')
-               target_cmd=(find "$SCRATCH_MNT" -print)
                ;;
        "%dir%")
                extra_filters+=('No such file or directory' 'Not a directory')
-               target_cmd=(find "$SCRATCH_MNT" -type d -print)
                ;;
        "%regfile%"|"%cowfile%")
                extra_filters+=('No such file or directory')
-               target_cmd=(find "$SCRATCH_MNT" -type f -print)
                ;;
        esac
 
+       local target_cmd=(echo "$scrub_tgt")
+       case "$scrub_tgt" in
+       "%file%")       target_cmd=($here/src/xfsfind -q  "$SCRATCH_MNT");;
+       "%attrfile%")   target_cmd=($here/src/xfsfind -qa "$SCRATCH_MNT");;
+       "%datafile%")   target_cmd=($here/src/xfsfind -qb "$SCRATCH_MNT");;
+       "%dir%")        target_cmd=($here/src/xfsfind -qd "$SCRATCH_MNT");;
+       "%regfile%")    target_cmd=($here/src/xfsfind -qr "$SCRATCH_MNT");;
+       "%cowfile%")    target_cmd=($here/src/xfsfind -qs "$SCRATCH_MNT");;
+       esac
+
        while __stress_scrub_running "$scrub_startat" "$runningfile"; do
                sleep 1
        done
 
        while __stress_scrub_running "$end" "$runningfile"; do
-               readarray -t fnames < <("${target_cmd[@]}" 2>/dev/null)
+               readarray -t fnames < <("${target_cmd[@]}" 2>> $seqres.full)
                for fname in "${fnames[@]}"; do
                        $XFS_IO_PROG -x "${xfs_io_args[@]}" "$fname" 2>&1 | \
                                __stress_scrub_filter_output "${extra_filters[@]}"
@@ -692,6 +699,7 @@ __stress_scrub_fsstress_loop() {
 # Make sure we have everything we need to run stress and scrub
 _require_xfs_stress_scrub() {
        _require_xfs_io_command "scrub"
+       _require_test_program "xfsfind"
        _require_command "$KILLALL_PROG" killall
        _require_freeze
        command -v _filter_scratch &>/dev/null || \
@@ -769,7 +777,8 @@ _scratch_xfs_stress_scrub_cleanup() {
 # filesystem before we start running them in a loop.
 __stress_scrub_check_commands() {
        local scrub_tgt="$1"
-       shift
+       local start_agno="$2"
+       shift; shift
 
        local cooked_tgt="$scrub_tgt"
        case "$scrub_tgt" in
@@ -798,7 +807,7 @@ __stress_scrub_check_commands() {
                if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then
                        cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')"
                fi
-               cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/0/g")"
+               cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/$start_agno/g")"
                testio=`$XFS_IO_PROG -x -c "$cooked_arg" "$cooked_tgt" 2>&1`
                echo $testio | grep -q "Unknown type" && \
                        _notrun "xfs_io scrub subcommand support is missing"
@@ -817,6 +826,7 @@ __stress_scrub_check_commands() {
 #
 # Various options include:
 #
+# -a   For %agno% substitution, start with this AG instead of AG 0.
 # -f   Run a freeze/thaw loop while we're doing other things.  Defaults to
 #      disabled, unless XFS_SCRUB_STRESS_FREEZE is set.
 # -i   Pass this command to xfs_io to exercise something that is not scrub
@@ -867,6 +877,7 @@ _scratch_xfs_stress_scrub() {
        local io_args=()
        local remount_period="${XFS_SCRUB_STRESS_REMOUNT_PERIOD}"
        local stress_tgt="${XFS_SCRUB_STRESS_TARGET:-default}"
+       local start_agno=0
 
        __SCRUB_STRESS_FREEZE_PID=""
        __SCRUB_STRESS_REMOUNT_LOOP=""
@@ -874,8 +885,9 @@ _scratch_xfs_stress_scrub() {
        touch "$runningfile"
 
        OPTIND=1
-       while getopts "fi:r:s:S:t:w:x:X:" c; do
+       while getopts "a:fi:r:s:S:t:w:x:X:" c; do
                case "$c" in
+                       a) start_agno="$OPTARG";;
                        f) freeze=yes;;
                        i) io_args+=("$OPTARG");;
                        r) remount_period="$OPTARG";;
@@ -889,7 +901,8 @@ _scratch_xfs_stress_scrub() {
                esac
        done
 
-       __stress_scrub_check_commands "$scrub_tgt" "${one_scrub_args[@]}"
+       __stress_scrub_check_commands "$scrub_tgt" "$start_agno" \
+                       "${one_scrub_args[@]}"
 
        if ! command -v "__stress_scrub_${exerciser}_loop" &>/dev/null; then
                echo "${exerciser}: Unknown fs exercise program."
@@ -936,7 +949,8 @@ _scratch_xfs_stress_scrub() {
 
        if [ "${#one_scrub_args[@]}" -gt 0 ]; then
                __stress_one_scrub_loop "$end" "$runningfile" "$scrub_tgt" \
-                               "$scrub_startat" "${one_scrub_args[@]}" &
+                               "$scrub_startat" "$start_agno" \
+                               "${one_scrub_args[@]}" &
        fi
 
        if [ "${#xfs_scrub_args[@]}" -gt 0 ]; then
diff --git a/tests/xfs/708 b/tests/xfs/708
new file mode 100755 (executable)
index 0000000..76da633
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 708
+#
+# Race fsstress and bnobt repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_online_repair -s "repair bnobt %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/708.out b/tests/xfs/708.out
new file mode 100644 (file)
index 0000000..33c478a
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 708
+Silence is golden
diff --git a/tests/xfs/709 b/tests/xfs/709
new file mode 100755 (executable)
index 0000000..247d108
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 709
+#
+# Race fsstress and inobt repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_online_repair -s "repair inobt %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/709.out b/tests/xfs/709.out
new file mode 100644 (file)
index 0000000..94e83ac
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 709
+Silence is golden
diff --git a/tests/xfs/710 b/tests/xfs/710
new file mode 100755 (executable)
index 0000000..45a2a2a
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 710
+#
+# Race fsstress and refcountbt repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_require_xfs_has_feature "$SCRATCH_MNT" reflink
+_scratch_xfs_stress_online_repair -s "repair refcountbt %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/710.out b/tests/xfs/710.out
new file mode 100644 (file)
index 0000000..f8de284
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 710
+Silence is golden
diff --git a/tests/xfs/711 b/tests/xfs/711
new file mode 100755 (executable)
index 0000000..0b1adb7
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 711
+#
+# Race fsstress and superblock repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_online_repair -a 1 -s "repair sb %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/711.out b/tests/xfs/711.out
new file mode 100644 (file)
index 0000000..6c18e66
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 711
+Silence is golden
diff --git a/tests/xfs/712 b/tests/xfs/712
new file mode 100755 (executable)
index 0000000..222b2b2
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 712
+#
+# Race fsstress and agf repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_online_repair -s "repair agf %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/712.out b/tests/xfs/712.out
new file mode 100644 (file)
index 0000000..a294469
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 712
+Silence is golden
diff --git a/tests/xfs/713 b/tests/xfs/713
new file mode 100755 (executable)
index 0000000..05b2a1a
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 713
+#
+# Race fsstress and agfl repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_online_repair -s "repair agfl %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/713.out b/tests/xfs/713.out
new file mode 100644 (file)
index 0000000..d7fdb8e
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 713
+Silence is golden
diff --git a/tests/xfs/714 b/tests/xfs/714
new file mode 100755 (executable)
index 0000000..cd84821
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 714
+#
+# Race fsstress and agi repair for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_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
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_online_repair
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_online_repair -s "repair agi %agno%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/714.out b/tests/xfs/714.out
new file mode 100644 (file)
index 0000000..f5ce748
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 714
+Silence is golden