From 76070f8f0e2c7943ce15f11f007d9a95a50d3ade Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 30 Dec 2022 14:19:12 -0800 Subject: [PATCH] xfs: stress test ag repair functions Race fsstress and various AG repair functions. Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- common/fuzzy | 38 ++++++++++++++++++++++++++------------ tests/xfs/708 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/708.out | 2 ++ tests/xfs/709 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/709.out | 2 ++ tests/xfs/710 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/710.out | 2 ++ tests/xfs/711 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/711.out | 2 ++ tests/xfs/712 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/712.out | 2 ++ tests/xfs/713 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/713.out | 2 ++ tests/xfs/714 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/714.out | 2 ++ 15 files changed, 300 insertions(+), 12 deletions(-) create mode 100755 tests/xfs/708 create mode 100644 tests/xfs/708.out create mode 100755 tests/xfs/709 create mode 100644 tests/xfs/709.out create mode 100755 tests/xfs/710 create mode 100644 tests/xfs/710.out create mode 100755 tests/xfs/711 create mode 100644 tests/xfs/711.out create mode 100755 tests/xfs/712 create mode 100644 tests/xfs/712.out create mode 100755 tests/xfs/713 create mode 100644 tests/xfs/713.out create mode 100755 tests/xfs/714 create mode 100644 tests/xfs/714.out diff --git a/common/fuzzy b/common/fuzzy index cc775b62..7d244cc1 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -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 index 00000000..76da6338 --- /dev/null +++ b/tests/xfs/708 @@ -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 index 00000000..33c478ad --- /dev/null +++ b/tests/xfs/708.out @@ -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 index 00000000..247d1083 --- /dev/null +++ b/tests/xfs/709 @@ -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 index 00000000..94e83acd --- /dev/null +++ b/tests/xfs/709.out @@ -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 index 00000000..45a2a2a3 --- /dev/null +++ b/tests/xfs/710 @@ -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 index 00000000..f8de2844 --- /dev/null +++ b/tests/xfs/710.out @@ -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 index 00000000..0b1adb76 --- /dev/null +++ b/tests/xfs/711 @@ -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 index 00000000..6c18e669 --- /dev/null +++ b/tests/xfs/711.out @@ -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 index 00000000..222b2b20 --- /dev/null +++ b/tests/xfs/712 @@ -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 index 00000000..a2944699 --- /dev/null +++ b/tests/xfs/712.out @@ -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 index 00000000..05b2a1a9 --- /dev/null +++ b/tests/xfs/713 @@ -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 index 00000000..d7fdb8e8 --- /dev/null +++ b/tests/xfs/713.out @@ -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 index 00000000..cd848216 --- /dev/null +++ b/tests/xfs/714 @@ -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 index 00000000..f5ce748b --- /dev/null +++ b/tests/xfs/714.out @@ -0,0 +1,2 @@ +QA output created by 714 +Silence is golden -- 2.39.5