aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-06-06 15:29:28 -0700
committerZorro Lang <zlang@kernel.org>2023-06-10 15:35:59 +0800
commit078bb0de7c2109b5fa54e567d82b82d6d3d75a59 (patch)
tree930af2b4561aabf4658f7dac4c1860152c614de4
parenteef60725c85068630c2375868a3426898392c5b8 (diff)
downloadxfstests-dev-078bb0de7c2109b5fa54e567d82b82d6d3d75a59.tar.gz
fuzzy: disallow post-test online rebuilds when testing online fsck
If we're testing the online fsck code or running fuzz tests of the filesystem, don't let the post-test checks rebuild the filesystem metadata, because this is redundant with the test and will disturb the metadata if the tools fail. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/fuzzy7
-rw-r--r--common/rc2
-rw-r--r--common/xfs12
3 files changed, 18 insertions, 3 deletions
diff --git a/common/fuzzy b/common/fuzzy
index a78a354142..7228158034 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -721,6 +721,9 @@ _scratch_xfs_fuzz_metadata() {
# Always capture full core dumps from crashing tools
ulimit -c unlimited
+ _xfs_skip_online_rebuild
+ _xfs_skip_offline_rebuild
+
echo "${fields}" | while read field; do
echo "${verbs}" | while read fuzzverb; do
__scratch_xfs_fuzz_mdrestore
@@ -1356,6 +1359,9 @@ _scratch_xfs_stress_scrub() {
rm -f "$tmp.scrub"
fi
+ _xfs_skip_online_rebuild
+ _xfs_skip_offline_rebuild
+
local start="$(date +%s)"
local end
if [ -n "$SOAK_DURATION" ]; then
@@ -1429,7 +1435,6 @@ __scratch_xfs_stress_setup_force_rebuild() {
# and wait for 30*TIME_FACTOR seconds to see if the filesystem goes down.
# Same requirements and arguments as _scratch_xfs_stress_scrub.
_scratch_xfs_stress_online_repair() {
- touch "$RESULT_DIR/.skip_orebuild" # no need to test online rebuild
__scratch_xfs_stress_setup_force_rebuild
XFS_SCRUB_FORCE_REPAIR=1 _scratch_xfs_stress_scrub "$@"
}
diff --git a/common/rc b/common/rc
index 37074371d7..c2ed40d768 100644
--- a/common/rc
+++ b/common/rc
@@ -1749,7 +1749,7 @@ _require_scratch_nocheck()
exit 1
fi
fi
- rm -f ${RESULT_DIR}/require_scratch "$RESULT_DIR/.skip_orebuild"
+ rm -f ${RESULT_DIR}/require_scratch "$RESULT_DIR/.skip_orebuild" "$RESULT_DIR/.skip_rebuild"
}
# we need the scratch device and it needs to not be an lvm device
diff --git a/common/xfs b/common/xfs
index 137ac9dbbe..d85acd9572 100644
--- a/common/xfs
+++ b/common/xfs
@@ -721,6 +721,16 @@ _scratch_xfs_mdrestore()
_xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$@"
}
+# Do not use xfs_repair (offline fsck) to rebuild the filesystem
+_xfs_skip_offline_rebuild() {
+ touch "$RESULT_DIR/.skip_rebuild"
+}
+
+# Do not use xfs_scrub (online fsck) to rebuild the filesystem
+_xfs_skip_online_rebuild() {
+ touch "$RESULT_DIR/.skip_orebuild"
+}
+
# run xfs_check and friends on a FS.
_check_xfs_filesystem()
{
@@ -849,7 +859,7 @@ _check_xfs_filesystem()
fi
# Optionally test the index rebuilding behavior.
- if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then
+ if [ -n "$TEST_XFS_REPAIR_REBUILD" ] && [ ! -e "$RESULT_DIR/.skip_rebuild" ]; then
rebuild_ok=1
$XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
if [ $? -ne 0 ]; then