diff mbox series

[2/2] xfs/43[4-6]: implement impatient module reloading

Message ID 173328390016.1190210.6222399993436200525.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/2] xfs/032: try running on blocksize > pagesize filesystems | expand

Commit Message

Darrick J. Wong Dec. 4, 2024, 3:46 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

These three tests try to reload the xfs module as a cheap way to detect
leaked inode and dquot objects when the slabs for those object are torn
down during rmmod.  Removal might not succeed, and we don't really care
for that case because we still want to exercise the log recovery code.

However, if (say) the root filesystem is xfs, then removal will never
succeed.  There's no way that waiting 50 seconds(!) per test is going
to change that.  Add a silly helper to do it fast or go home.

Reported-by: sandeen@sandeen.net
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 common/module |   11 +++++++++++
 tests/xfs/434 |    2 +-
 tests/xfs/435 |    2 +-
 tests/xfs/436 |    2 +-
 4 files changed, 14 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/common/module b/common/module
index a8d5f492d3f416..697d76ba718bbc 100644
--- a/common/module
+++ b/common/module
@@ -214,3 +214,14 @@  _patient_rmmod()
 
 	return $mod_ret
 }
+
+# Try to reload a filesystem driver.  Don't wait if we can't remove the module,
+# and don't let failures related to removing the module escape.  The caller
+# doesn't care if removal doesn't work.
+_optional_reload_fs_module()
+{
+	MODPROBE_PATIENT_RM_TIMEOUT_SECONDS=0 \
+		MODPROBE_REMOVE_PATIENT="" \
+		_test_loadable_fs_module "$@" 2>&1 | \
+		sed -e '/patient module removal/d'
+}
diff --git a/tests/xfs/434 b/tests/xfs/434
index c5122884324eb0..fe609b138d732b 100755
--- a/tests/xfs/434
+++ b/tests/xfs/434
@@ -74,7 +74,7 @@  _scratch_unmount 2> /dev/null
 rm -f ${RESULT_DIR}/require_scratch
 
 echo "See if we leak"
-_test_loadable_fs_module "xfs"
+_optional_reload_fs_module "xfs"
 
 # success, all done
 status=0
diff --git a/tests/xfs/435 b/tests/xfs/435
index 0bb5675e1dba23..22c02fbd1289bb 100755
--- a/tests/xfs/435
+++ b/tests/xfs/435
@@ -52,7 +52,7 @@  _scratch_unmount 2> /dev/null
 rm -f ${RESULT_DIR}/require_scratch
 
 echo "See if we leak"
-_test_loadable_fs_module "xfs"
+_optional_reload_fs_module "xfs"
 
 # success, all done
 status=0
diff --git a/tests/xfs/436 b/tests/xfs/436
index 1f7eb329e1394e..6a9d93d95f432f 100755
--- a/tests/xfs/436
+++ b/tests/xfs/436
@@ -69,7 +69,7 @@  _scratch_unmount 2> /dev/null
 rm -f ${RESULT_DIR}/require_scratch
 
 echo "See if we leak"
-_test_loadable_fs_module "xfs"
+_optional_reload_fs_module "xfs"
 
 # success, all done
 status=0