[PATCH 2/2] xfs: stress test xfs_scrub(8) with freeze and ro-remount loops

Darrick J. Wong
2022-12-30T22:59:45Z

Make sure we don't trip over any asserts or livelock when scrub races
with filesystem freezing and readonly remounts.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/733 | 39 +++++++++++++++++++++++++++++++++++++++
tests/xfs/733.out | 2 ++
tests/xfs/771 | 39 +++++++++++++++++++++++++++++++++++++++
tests/xfs/771.out | 2 ++
tests/xfs/824 | 40 ++++++++++++++++++++++++++++++++++++++++
tests/xfs/824.out | 2 ++
tests/xfs/825 | 40 ++++++++++++++++++++++++++++++++++++++++
tests/xfs/825.out | 2 ++
8 files changed, 166 insertions(+)
create mode 100755 tests/xfs/733
create mode 100644 tests/xfs/733.out
create mode 100755 tests/xfs/771
create mode 100644 tests/xfs/771.out
create mode 100755 tests/xfs/824
create mode 100644 tests/xfs/824.out
create mode 100755 tests/xfs/825
create mode 100644 tests/xfs/825.out

diff --git a/tests/xfs/733 b/tests/xfs/733
new file mode 100755
index 0000000000..ee9a0a26ee
--- /dev/null
+++ b/tests/xfs/733
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 733
+#
+# Race xfs_scrub in check-only mode and ro remount for a while to see if we
+# crash or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ _scratch_remount rw
+ rm -rf $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./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 -r 5 -S '-n'
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/xfs/733.out b/tests/xfs/733.out
new file mode 100644
index 0000000000..7118d5ddf0
--- /dev/null
+++ b/tests/xfs/733.out
@@ -0,0 +1,2 @@
+QA output created by 733
+Silence is golden
diff --git a/tests/xfs/771 b/tests/xfs/771
new file mode 100755
index 0000000000..8c8d124f12
--- /dev/null
+++ b/tests/xfs/771
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 771
+#
+# Race xfs_scrub in check-only mode and freeze for a while to see if we crash
+# or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ _scratch_remount rw
+ rm -rf $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./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 -f -S '-n'
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/xfs/771.out b/tests/xfs/771.out
new file mode 100644
index 0000000000..c2345c7be3
--- /dev/null
+++ b/tests/xfs/771.out
@@ -0,0 +1,2 @@
+QA output created by 771
+Silence is golden
diff --git a/tests/xfs/824 b/tests/xfs/824
new file mode 100755
index 0000000000..65eeb3a6c9
--- /dev/null
+++ b/tests/xfs/824
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 824
+#
+# Race xfs_scrub in force-repair mdoe and freeze for a while to see if we crash
+# or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ _scratch_remount rw
+ rm -rf $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/xfs
+. ./common/inject
+
+# 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 -f -S '-k'
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/xfs/824.out b/tests/xfs/824.out
new file mode 100644
index 0000000000..6cf432abbd
--- /dev/null
+++ b/tests/xfs/824.out
@@ -0,0 +1,2 @@
+QA output created by 824
+Silence is golden
diff --git a/tests/xfs/825 b/tests/xfs/825
new file mode 100755
index 0000000000..80ce06932d
--- /dev/null
+++ b/tests/xfs/825
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 825
+#
+# Race xfs_scrub in force-repair mode and ro remount for a while to see if we
+# crash or livelock.
+#
+. ./common/preamble
+_begin_fstest online_repair dangerous_fsstress_repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ _scratch_remount rw
+ rm -rf $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/xfs
+. ./common/inject
+
+# 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 -r 5 -S '-k'
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/xfs/825.out b/tests/xfs/825.out
new file mode 100644
index 0000000000..d0e970dfd6
--- /dev/null
+++ b/tests/xfs/825.out
@@ -0,0 +1,2 @@
+QA output created by 825
+Silence is golden