From: Darrick J. Wong Date: Wed, 15 Mar 2023 00:58:17 +0000 (-0700) Subject: xfs: stress test cycling parent pointers with online repair X-Git-Tag: v2023.03.19^0 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=02200cb8853dcd4cb6272126b7f9bc0a83b889c6;p=xfstests-dev.git xfs: stress test cycling parent pointers with online repair Add a couple of new tests to exercise directory and parent pointer repair against rename() calls moving child subdirectories from one parent to another. This is a useful test because it turns out that the VFS doesn't lock the child subdirectory (it does lock the parents), so repair must be more careful. Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/common/fuzzy b/common/fuzzy index 470bec47..961bedc7 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -986,6 +986,20 @@ __stress_scrub_fsstress_loop() { local focus=() case "$stress_tgt" in + "parent") + focus+=('-z') + + # Create a directory tree very gradually + for op in creat link mkdir; do + focus+=('-f' "${op}=2") + done + focus+=('-f' 'unlink=1' '-f' 'rmdir=1') + + # But do a lot of renames to cycle parent pointers + for op in rename rnoreplace rexchange; do + focus+=('-f' "${op}=40") + done + ;; "dir") focus+=('-z') @@ -1276,6 +1290,7 @@ __stress_scrub_check_commands() { # 'writeonly': Only perform fs updates, no reads. # 'symlink': Only create symbolic links. # 'mknod': Only create special files. +# 'parent': Focus on updating parent pointers # # The default is 'default' unless XFS_SCRUB_STRESS_TARGET is set. # -X Run this program to exercise the filesystem. Currently supported diff --git a/tests/xfs/799 b/tests/xfs/799 new file mode 100755 index 00000000..4391686e --- /dev/null +++ b/tests/xfs/799 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 799 +# +# Race fsstress doing mostly renames and xfs_scrub in force-repair mode for a +# while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + cd / + _scratch_xfs_stress_scrub_cleanup &> /dev/null + 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 '-k' -x 'parent' + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/799.out b/tests/xfs/799.out new file mode 100644 index 00000000..f3fd9fa2 --- /dev/null +++ b/tests/xfs/799.out @@ -0,0 +1,2 @@ +QA output created by 799 +Silence is golden diff --git a/tests/xfs/800 b/tests/xfs/800 new file mode 100755 index 00000000..a23e4733 --- /dev/null +++ b/tests/xfs/800 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 800 +# +# Race fsstress doing mostly renames and xfs_scrub in read-only mode for a +# while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + cd / + _scratch_xfs_stress_scrub_cleanup &> /dev/null + 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_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -S '-n' -x 'parent' + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/800.out b/tests/xfs/800.out new file mode 100644 index 00000000..bdfaa2ce --- /dev/null +++ b/tests/xfs/800.out @@ -0,0 +1,2 @@ +QA output created by 800 +Silence is golden