[PATCH 14/16] fuzzy: make freezing optional for scrub stress tests

Darrick J. Wong
2022-12-30T22:57:53Z

Make the freeze/thaw loop optional, since that's a significant change in
behavior if it's enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
common/fuzzy | 13 ++++++++++---
tests/xfs/422 | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/common/fuzzy b/common/fuzzy
index 0f6fc91b80..219dd3bb0a 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -499,6 +499,8 @@ __stress_scrub_check_commands() {
#
# Various options include:
#
+# -f Run a freeze/thaw loop while we're doing other things. Defaults to
+# disabled, unless XFS_SCRUB_STRESS_FREEZE is set.
# -s Pass this command to xfs_io to test scrub. If zero -s options are
# specified, xfs_io will not be run.
# -t Run online scrub against this file; $SCRATCH_MNT is the default.
@@ -506,14 +508,16 @@ _scratch_xfs_stress_scrub() {
local one_scrub_args=()
local scrub_tgt="$SCRATCH_MNT"
local runningfile="$tmp.fsstress"
+ local freeze="${XFS_SCRUB_STRESS_FREEZE}"

__SCRUB_STRESS_FREEZE_PID=""
rm -f "$runningfile"
touch "$runningfile"

OPTIND=1
- while getopts "s:t:" c; do
+ while getopts "fs:t:" c; do
case "$c" in
+ f) freeze=yes;;
s) one_scrub_args+=("$OPTARG");;
t) scrub_tgt="$OPTARG";;
*) return 1; ;;
@@ -529,8 +533,11 @@ _scratch_xfs_stress_scrub() {
"ending at $(date --date="@${end}")" >> $seqres.full

__stress_scrub_fsstress_loop "$end" "$runningfile" &
- __stress_scrub_freeze_loop "$end" "$runningfile" &
- __SCRUB_STRESS_FREEZE_PID="$!"
+
+ if [ -n "$freeze" ]; then
+ __stress_scrub_freeze_loop "$end" "$runningfile" &
+ __SCRUB_STRESS_FREEZE_PID="$!"
+ fi

if [ "${#one_scrub_args[@]}" -gt 0 ]; then
__stress_one_scrub_loop "$end" "$runningfile" "$scrub_tgt" \
diff --git a/tests/xfs/422 b/tests/xfs/422
index faea5d6792..ac88713257 100755
--- a/tests/xfs/422
+++ b/tests/xfs/422
@@ -31,7 +31,7 @@ _require_xfs_stress_online_repair
_scratch_mkfs > "$seqres.full" 2>&1
_scratch_mount
_require_xfs_has_feature "$SCRATCH_MNT" rmapbt
-_scratch_xfs_stress_online_repair -s "repair rmapbt 0" -s "repair rmapbt 1"
+_scratch_xfs_stress_online_repair -f -s "repair rmapbt 0" -s "repair rmapbt 1"

# success, all done
echo Silence is golden