public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH] xfs: stress test cycling parent pointers with online repair
Date: Tue, 14 Mar 2023 17:58:17 -0700	[thread overview]
Message-ID: <20230315005817.GA11360@frogsfrogsfrogs> (raw)

From: Darrick J. Wong <djwong@kernel.org>

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 <djwong@kernel.org>
---
 common/fuzzy      |   15 +++++++++++++++
 tests/xfs/854     |   38 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/854.out |    2 ++
 tests/xfs/855     |   38 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/855.out |    2 ++
 5 files changed, 95 insertions(+)
 create mode 100755 tests/xfs/854
 create mode 100644 tests/xfs/854.out
 create mode 100755 tests/xfs/855
 create mode 100644 tests/xfs/855.out

diff --git a/common/fuzzy b/common/fuzzy
index 4609df4434..744d9ed65d 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -995,6 +995,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')
 
@@ -1285,6 +1299,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/854 b/tests/xfs/854
new file mode 100755
index 0000000000..0aa2c2ee4f
--- /dev/null
+++ b/tests/xfs/854
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Oracle, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 854
+#
+# 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/854.out b/tests/xfs/854.out
new file mode 100644
index 0000000000..f8d9e27958
--- /dev/null
+++ b/tests/xfs/854.out
@@ -0,0 +1,2 @@
+QA output created by 854
+Silence is golden
diff --git a/tests/xfs/855 b/tests/xfs/855
new file mode 100755
index 0000000000..6daff05995
--- /dev/null
+++ b/tests/xfs/855
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Oracle, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 855
+#
+# 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/855.out b/tests/xfs/855.out
new file mode 100644
index 0000000000..fa60f65432
--- /dev/null
+++ b/tests/xfs/855.out
@@ -0,0 +1,2 @@
+QA output created by 855
+Silence is golden

             reply	other threads:[~2023-03-15  0:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15  0:58 Darrick J. Wong [this message]
2023-03-15 18:02 ` [PATCH] xfs: stress test cycling parent pointers with online repair Zorro Lang
2023-03-15 21:17   ` Darrick J. Wong
2023-03-16  6:07     ` Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230315005817.GA11360@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox