public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: fstests@vger.kernel.org
Cc: hare@suse.de, dgilbert@interlog.com, jeyu@kernel.org,
	lucas.demarchi@intel.com, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>, Eryu Guan <guan@eryu.me>
Subject: [PATCH] common/module: use patient module removal
Date: Tue, 21 Sep 2021 10:49:52 -0700	[thread overview]
Message-ID: <20210921174952.1286037-1-mcgrof@kernel.org> (raw)

Now that scsi_debug has been using the patient module removal
for a while, let's generalize its use for the other use cases.
This likey will fix some odd false positives due to races.

Suggested-by: Eryu Guan <guan@eryu.me>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 common/module | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/module b/common/module
index 0392f20c..ead0f881 100644
--- a/common/module
+++ b/common/module
@@ -16,7 +16,7 @@ _reload_module()
 {
 	local module="$1"
 
-	modprobe -r "${module}" || _fail "${module} unload failed"
+	_patient_rmmod "${module}" || _fail "${module} unload failed"
 	modprobe "${module}" || _fail "${module} load failed"
 }
 
@@ -44,7 +44,7 @@ _require_loadable_module()
 	local module="$1"
 
 	modinfo "${module}" > /dev/null 2>&1 || _notrun "${module}: must be a module."
-	modprobe -r "${module}" || _notrun "Require ${module} to be unloadable"
+	_patient_rmmod "${module}" || _notrun "Require ${module} to be unloadable"
 	modprobe "${module}" || _notrun "${module} load failed"
 }
 
@@ -64,7 +64,7 @@ _require_loadable_fs_module()
 	test -n "${had_scratchfs}" && _scratch_unmount
 	local unload_ok=""
 	local load_ok=""
-	modprobe -r "${module}" || unload_ok=0
+	_patient_rmmod "${module}" || unload_ok=0
 	modprobe "${module}" || load_ok=0
 	test -n "${had_scratchfs}" && _scratch_mount 2> /dev/null
 	test -n "${had_testfs}" && _test_mount 2> /dev/null
-- 
2.30.2


                 reply	other threads:[~2021-09-21 17:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210921174952.1286037-1-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=dgilbert@interlog.com \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=hare@suse.de \
    --cc=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.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