From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, guan@eryu.me, fstests@vger.kernel.org
Subject: [PATCH v1.1 7/8] xfs/43[4-6]: make module reloading optional
Date: Fri, 1 Mar 2024 09:51:24 -0800 [thread overview]
Message-ID: <20240301175124.GJ1927156@frogsfrogsfrogs> (raw)
In-Reply-To: <170899915319.896550.14222768162023866668.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
These three tests examine two things -- first, can xfs CoW staging
extent recovery handle corruptions in the refcount btree gracefully; and
second, can we avoid leaking incore inodes and dquots.
The only cheap way to check the second condition is to rmmod and
modprobe the XFS module, which triggers leak detection when rmmod tears
down the caches. Currently, the entire test is _notrun if module
reloading doesn't work.
Unfortunately, these tests never run for the majority of XFS developers
because their testbeds either compile the xfs kernel driver into vmlinux
statically or the rootfs is xfs so the module cannot be reloaded. The
author's testbed boots from NFS and does not have this limitation.
Because we've had repeated instances of CoW recovery regressions not
being caught by testing until for-next hits my machine, let's make the
module reloading optional in all three tests to improve coverage.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
v1.1: address some review comments from maintainer
---
common/module | 33 ++++++++++++++++++++++++++++-----
tests/xfs/434 | 3 +--
tests/xfs/435 | 3 +--
tests/xfs/436 | 3 +--
4 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/common/module b/common/module
index 6efab71d34..a8d5f492d3 100644
--- a/common/module
+++ b/common/module
@@ -48,12 +48,15 @@ _require_loadable_module()
modprobe "${module}" || _notrun "${module} load failed"
}
-# Check that the module for FSTYP can be loaded.
-_require_loadable_fs_module()
+# Test if the module for FSTYP can be unloaded and reloaded.
+#
+# If not, returns 1 if $FSTYP is not a loadable module; 2 if the module could
+# not be unloaded; or 3 if loading the module fails.
+_test_loadable_fs_module()
{
local module="$1"
- modinfo "${module}" > /dev/null 2>&1 || _notrun "${module}: must be a module."
+ modinfo "${module}" > /dev/null 2>&1 || return 1
# Unload test fs, try to reload module, remount
local had_testfs=""
@@ -68,8 +71,28 @@ _require_loadable_fs_module()
modprobe "${module}" || load_ok=0
test -n "${had_scratchfs}" && _scratch_mount 2> /dev/null
test -n "${had_testfs}" && _test_mount 2> /dev/null
- test -z "${unload_ok}" || _notrun "Require module ${module} to be unloadable"
- test -z "${load_ok}" || _notrun "${module} load failed"
+ test -z "${unload_ok}" || return 2
+ test -z "${load_ok}" || return 3
+ return 0
+}
+
+_require_loadable_fs_module()
+{
+ local module="$1"
+
+ _test_loadable_fs_module "${module}"
+ ret=$?
+ case "$ret" in
+ 1)
+ _notrun "${module}: must be a module."
+ ;;
+ 2)
+ _notrun "${module}: module could not be unloaded"
+ ;;
+ 3)
+ _notrun "${module}: module reload failed"
+ ;;
+ esac
}
# Print the value of a filesystem module parameter
diff --git a/tests/xfs/434 b/tests/xfs/434
index 12d1a0c9da..ca80e12753 100755
--- a/tests/xfs/434
+++ b/tests/xfs/434
@@ -30,7 +30,6 @@ _begin_fstest auto quick clone fsr
# real QA test starts here
_supported_fs xfs
-_require_loadable_fs_module "xfs"
_require_quota
_require_scratch_reflink
_require_cp_reflink
@@ -77,7 +76,7 @@ _scratch_unmount 2> /dev/null
rm -f ${RESULT_DIR}/require_scratch
echo "See if we leak"
-_reload_fs_module "xfs"
+_test_loadable_fs_module "xfs"
# success, all done
status=0
diff --git a/tests/xfs/435 b/tests/xfs/435
index 44135c7653..b52e9287df 100755
--- a/tests/xfs/435
+++ b/tests/xfs/435
@@ -24,7 +24,6 @@ _begin_fstest auto quick clone
# real QA test starts here
_supported_fs xfs
-_require_loadable_fs_module "xfs"
_require_quota
_require_scratch_reflink
_require_cp_reflink
@@ -55,7 +54,7 @@ _scratch_unmount 2> /dev/null
rm -f ${RESULT_DIR}/require_scratch
echo "See if we leak"
-_reload_fs_module "xfs"
+_test_loadable_fs_module "xfs"
# success, all done
status=0
diff --git a/tests/xfs/436 b/tests/xfs/436
index d010362785..02bcd66900 100755
--- a/tests/xfs/436
+++ b/tests/xfs/436
@@ -27,7 +27,6 @@ _begin_fstest auto quick clone fsr
# real QA test starts here
_supported_fs xfs
-_require_loadable_fs_module "xfs"
_require_scratch_reflink
_require_cp_reflink
_require_xfs_io_command falloc # fsr requires support for preallocation
@@ -72,7 +71,7 @@ _scratch_unmount 2> /dev/null
rm -f ${RESULT_DIR}/require_scratch
echo "See if we leak"
-_reload_fs_module "xfs"
+_test_loadable_fs_module "xfs"
# success, all done
status=0
next prev parent reply other threads:[~2024-03-01 17:51 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 2:00 [PATCHSET] fstests: random fixes for v2024.02.09 Darrick J. Wong
2024-02-27 2:00 ` [PATCH 1/8] generic/604: try to make race occur reliably Darrick J. Wong
2024-02-27 4:04 ` Zorro Lang
2024-02-27 4:27 ` Darrick J. Wong
2024-02-27 4:40 ` [PATCH v1.1 " Darrick J. Wong
2024-02-27 5:15 ` Zorro Lang
2024-02-27 14:52 ` Christoph Hellwig
2024-03-02 11:44 ` Zorro Lang
2024-02-27 2:01 ` [PATCH 2/8] xfs/155: fail the test if xfs_repair hangs for too long Darrick J. Wong
2024-02-27 4:16 ` Zorro Lang
2024-02-27 4:41 ` [PATCH v1.1 " Darrick J. Wong
2024-02-27 5:14 ` Zorro Lang
2024-02-27 14:52 ` Christoph Hellwig
2024-02-27 2:01 ` [PATCH 3/8] generic/192: fix spurious timeout Darrick J. Wong
2024-02-27 4:23 ` Zorro Lang
2024-02-27 4:29 ` Darrick J. Wong
2024-02-27 14:53 ` Christoph Hellwig
2024-02-27 2:01 ` [PATCH 4/8] generic/491: increase test timeout Darrick J. Wong
2024-02-27 4:28 ` Zorro Lang
2024-02-27 14:53 ` Christoph Hellwig
2024-02-27 2:01 ` [PATCH 5/8] xfs/599: reduce the amount of attrs created here Darrick J. Wong
2024-02-27 4:33 ` Zorro Lang
2024-02-27 2:02 ` [PATCH 6/8] xfs/122: update test to pick up rtword/suminfo ondisk unions Darrick J. Wong
2024-02-27 5:10 ` Zorro Lang
2024-02-27 14:54 ` Christoph Hellwig
2024-02-28 1:27 ` Darrick J. Wong
2024-02-28 15:39 ` Christoph Hellwig
2024-02-29 17:48 ` Darrick J. Wong
2024-02-29 19:42 ` Christoph Hellwig
2024-03-01 13:18 ` Zorro Lang
2024-03-01 17:50 ` Darrick J. Wong
2024-03-02 4:55 ` Zorro Lang
2024-03-07 23:24 ` Darrick J. Wong
2024-02-27 2:02 ` [PATCH 7/8] xfs/43[4-6]: make module reloading optional Darrick J. Wong
2024-02-27 5:31 ` Zorro Lang
2024-02-28 1:28 ` Darrick J. Wong
2024-03-01 17:51 ` Darrick J. Wong [this message]
2024-03-02 12:04 ` [PATCH v1.1 " Zorro Lang
2024-02-27 2:02 ` [PATCH 8/8] xfs: test for premature ENOSPC with large cow delalloc extents Darrick J. Wong
2024-02-27 6:00 ` Zorro Lang
2024-02-28 1:36 ` Darrick J. Wong
2024-03-01 17:52 ` [PATCH v1.1 " Darrick J. Wong
2024-03-02 20:50 ` Zorro Lang
2024-03-07 23:17 ` Darrick J. Wong
2024-03-07 23:22 ` [PATCH v1.2 " Darrick J. Wong
2024-03-10 9:17 ` Zorro Lang
2024-03-10 16:26 ` Darrick J. Wong
2024-03-11 13:40 ` Zorro Lang
2024-03-11 15:04 ` Darrick J. Wong
2024-03-03 13:34 ` [PATCHSET] fstests: random fixes for v2024.02.09 Zorro Lang
2024-03-07 23:18 ` Darrick J. Wong
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=20240301175124.GJ1927156@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--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