[PATCH v4 6/7] common: move module_unload to common
From: Sagi Grimberg <sagi@grimberg.me>
Date: 2020-08-14 06:18:56
Also in:
linux-nvme
Subsystem:
the rest · Maintainer:
Linus Torvalds
It creates a dependency between multipath-over-rdma and test/nvmeof/rc (and test/srp/rc) which is not a natural home for it. Move it to common helpers. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> --- common/rc | 13 +++++++++++++ tests/nvmeof-mp/rc | 13 ------------- tests/srp/rc | 13 ------------- 3 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/common/rc b/common/rc
index 7f02103dc786..cdc0150ea5ea 100644
--- a/common/rc
+++ b/common/rc@@ -291,3 +291,16 @@ _filter_xfs_io_error() { _uptime_s() { awk '{ print int($1) }' /proc/uptime } + +# Arguments: module to unload ($1) and retry count ($2). +unload_module() { + local i m=$1 rc=${2:-1} + + [ ! -e "/sys/module/$m" ] && return 0 + for ((i=rc;i>0;i--)); do + modprobe -r "$m" + [ ! -e "/sys/module/$m" ] && return 0 + sleep .1 + done + return 1 +}
diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc
index e446db297ba1..829b26624b7f 100755
--- a/tests/nvmeof-mp/rc
+++ b/tests/nvmeof-mp/rc@@ -145,19 +145,6 @@ remove_mpath_devs() { } &>> "$FULL" } -# Arguments: module to unload ($1) and retry count ($2). -unload_module() { - local i m=$1 rc=${2:-1} - - [ ! -e "/sys/module/$m" ] && return 0 - for ((i=rc;i>0;i--)); do - modprobe -r "$m" - [ ! -e "/sys/module/$m" ] && return 0 - sleep .1 - done - return 1 -} - start_nvme_client() { modprobe nvme-core dyndbg=+pmf && modprobe nvme dyndbg=+pmf &&
diff --git a/tests/srp/rc b/tests/srp/rc
index 4013e9514767..c36515066ffb 100755
--- a/tests/srp/rc
+++ b/tests/srp/rc@@ -320,19 +320,6 @@ remove_mpath_devs() { } &>> "$FULL" } -# Arguments: module to unload ($1) and retry count ($2). -unload_module() { - local i m=$1 rc=${2:-1} - - [ ! -e "/sys/module/$m" ] && return 0 - for ((i=rc;i>0;i--)); do - modprobe -r "$m" - [ ! -e "/sys/module/$m" ] && return 0 - sleep .1 - done - return 1 -} - # Load the SRP initiator driver with kernel module parameters $1..$n. start_srp_ini() { modprobe scsi_transport_srp || return $?
--
2.25.1