[PATCH v3 6/7] common: move module_unload to common

Bart Van Assche bvanassche at acm.org
Tue Aug 11 17:30:39 EDT 2020


On 2020-08-11 14:01, Sagi Grimberg wrote:
> It creates a dependency between multipath-over-rdma
> and test/nvmeof/rc which is not a natural home
> for it. Move it to common helpers.
> 
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
>  common/rc          | 13 +++++++++++++
>  tests/nvmeof-mp/rc | 13 -------------
>  2 files changed, 13 insertions(+), 13 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 &&
> 

Hi Sagi,

I think there is another copy of unload_module() in tests/srp/rc. How about
also removing that copy?

Thanks,

Bart.



More information about the Linux-nvme mailing list