diff mbox series

[blktests,1/5] tests/srp/rc: update the ib_srpt module name

Message ID 20201124010427.18595-2-yi.zhang@redhat.com (mailing list archive)
State New, archived
Headers show
Series nvmeof-mp/srp/nvme-rdma misc fix and enhancement | expand

Commit Message

Yi Zhang Nov. 24, 2020, 1:04 a.m. UTC
Fix the ib_srpt module insmod failure as the module in some distros are
end with .xz, like bellow on fedora:
/lib/modules/$(uname -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko.xz

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
---
 tests/srp/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bart Van Assche Nov. 24, 2020, 3:23 a.m. UTC | #1
On 11/23/20 5:04 PM, Yi Zhang wrote:
> -	insmod "/lib/modules/$(uname -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko" "${opts[@]}" || return $?
> +	insmod "$(ls /lib/modules/"$(uname -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" || return $?

Is 'ls' needed here or is 'echo' sufficient?

Thanks,

Bart.
Yi Zhang Nov. 24, 2020, 2:01 p.m. UTC | #2
On 11/24/20 11:23 AM, Bart Van Assche wrote:
> On 11/23/20 5:04 PM, Yi Zhang wrote:
>> -	insmod "/lib/modules/$(uname -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko" "${opts[@]}" || return $?
>> +	insmod "$(ls /lib/modules/"$(uname -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" || return $?
> Is 'ls' needed here or is 'echo' sufficient?
Actually it doesn't work without ls
$ insmod "/lib/modules/"$(uname 
-r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*"
insmod: ERROR: could not load module 
/lib/modules/5.10.0-rc5/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*: No 
such file or directory

and it works with echo, I can change to echo if you prefer
$ insmod "$(echo /lib/modules/"$(uname 
-r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" || 
return $?

> Thanks,
>
> Bart.
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>
Bart Van Assche Nov. 25, 2020, 3:47 a.m. UTC | #3
On 11/24/20 6:01 AM, Yi Zhang wrote:
> On 11/24/20 11:23 AM, Bart Van Assche wrote:
>> On 11/23/20 5:04 PM, Yi Zhang wrote:
>>> -    insmod "/lib/modules/$(uname
>>> -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko" "${opts[@]}" ||
>>> return $?
>>> +    insmod "$(ls /lib/modules/"$(uname
>>> -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" ||
>>> return $?
>> Is 'ls' needed here or is 'echo' sufficient?
> Actually it doesn't work without ls
> $ insmod "/lib/modules/"$(uname
> -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*"
> insmod: ERROR: could not load module
> /lib/modules/5.10.0-rc5/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*: No
> such file or directory
> 
> and it works with echo, I can change to echo if you prefer
> $ insmod "$(echo /lib/modules/"$(uname
> -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" ||
> return $?

'echo' is a shell built-in while ls is not built-in into bash, so echo
is faster.

How about insmod "/lib/modules/$(uname
-r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt."* (no echo, no ls,
asterisk outside double quotes)?

Thanks,

Bart.
Yi Zhang Nov. 25, 2020, 7:36 a.m. UTC | #4
On 11/25/20 11:47 AM, Bart Van Assche wrote:
> On 11/24/20 6:01 AM, Yi Zhang wrote:
>> On 11/24/20 11:23 AM, Bart Van Assche wrote:
>>> On 11/23/20 5:04 PM, Yi Zhang wrote:
>>>> -    insmod "/lib/modules/$(uname
>>>> -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko" "${opts[@]}" ||
>>>> return $?
>>>> +    insmod "$(ls /lib/modules/"$(uname
>>>> -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" ||
>>>> return $?
>>> Is 'ls' needed here or is 'echo' sufficient?
>> Actually it doesn't work without ls
>> $ insmod "/lib/modules/"$(uname
>> -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*"
>> insmod: ERROR: could not load module
>> /lib/modules/5.10.0-rc5/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*: No
>> such file or directory
>>
>> and it works with echo, I can change to echo if you prefer
>> $ insmod "$(echo /lib/modules/"$(uname
>> -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" ||
>> return $?
> 'echo' is a shell built-in while ls is not built-in into bash, so echo
> is faster.
yeah, thanks for the info.
> How about insmod "/lib/modules/$(uname
> -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt."* (no echo, no ls,
> asterisk outside double quotes)?
This works, have updated to V2

> Thanks,
>
> Bart.
>
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
diff mbox series

Patch

diff --git a/tests/srp/rc b/tests/srp/rc
index 7fc094b..74053ba 100755
--- a/tests/srp/rc
+++ b/tests/srp/rc
@@ -465,7 +465,7 @@  configure_target_ports() {
 
 # Load LIO and configure the SRP target driver and LUNs.
 start_lio_srpt() {
-	local b d gid i ini_ids=() opts p target_ids=() vdev
+	local b d gid i ini_ids=() opts p target_ids=()
 
 	for gid in $(all_primary_gids); do
 		if [ "${gid#fe8}" != "$gid" ]; then
@@ -500,7 +500,7 @@  start_lio_srpt() {
 	if modinfo ib_srpt | grep -q '^parm:[[:blank:]]*rdma_cm_port:'; then
 		opts+=("rdma_cm_port=${srp_rdma_cm_port}")
 	fi
-	insmod "/lib/modules/$(uname -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko" "${opts[@]}" || return $?
+	insmod "$(ls /lib/modules/"$(uname -r)"/kernel/drivers/infiniband/ulp/srpt/ib_srpt.*)" "${opts[@]}" || return $?
 	i=0
 	for r in "${vdev_path[@]}"; do
 		if [ -b "$(readlink -f "$r")" ]; then