]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs/43[4-6]: make module reloading optional
authorDarrick J. Wong <djwong@kernel.org>
Fri, 1 Mar 2024 17:51:24 +0000 (09:51 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 12 Mar 2024 03:33:41 +0000 (11:33 +0800)
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>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/module
tests/xfs/434
tests/xfs/435
tests/xfs/436

index 6efab71d348e8ad9c49313c04e74a31f3d49ac24..a8d5f492d3f4164ec8d12600c5cc124515523a6e 100644 (file)
@@ -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
index 12d1a0c9da3393e1c2f984e5767a8e4d12e6fbfd..ca80e127530d34e149038a59ed4cb0563f36bfa3 100755 (executable)
@@ -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
index 44135c7653e5f3670b2b1068939fce1ab2834a27..b52e9287dfcb758dfbbebb0aae2cc7329c8a8888 100755 (executable)
@@ -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
index d010362785b2a9993f2151f0900a540c539d96b6..02bcd66900a179b58c3ef86b3c8149cb01a90491 100755 (executable)
@@ -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