Skip to contentSkip to conversation

common/multipath-over-rdma: make block scheduler directory optional

PATCH In review Luis Chamberlain 3 participants 3 messages Jul 29, 2020 – Aug 4, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/multipath-over-rdma: make block scheduler directory optional

We currently fail if the following tests if the directory /lib/modules/$(uname -r)/kernel/block does not exist. Just make this optional. Older distributions won't have this directory.

srp/001
srp/002
srp/013
srp/014

---
 common/multipath-over-rdma | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
common/multipath-over-rdma +7 -4
index 676d283..f004124 100644
@@ -696,10 +696,13 @@ setup_test() {
 
 	# Load the I/O scheduler kernel modules
 	(
-		cd "/lib/modules/$(uname -r)/kernel/block" &&
-			for m in *.ko; do
-				[ -e "$m" ] && modprobe "${m%.ko}"
-			done
+		KERNEL_BLOCK="/lib/modules/$(uname -r)/kernel/block"
+		if [ -d $KERNEL_BLOCK ]; then
+			cd $KERNEL_BLOCK &&
+				for m in *.ko; do
+					[ -e "$m" ] && modprobe "${m%.ko}"
+				done
+		fi
 	)
 
 	if [ -d /sys/kernel/debug/dynamic_debug ]; then
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Luis,

[cc: Omar]

blktests patches should have a 'PATCH blktests' subject prefix.

Quoted 3 lines · Luis Chamberlain

We currently fail if the following tests if the directory /lib/modules/$(uname -r)/kernel/block does not exist. Just make this optional. Older distributions won't have this directory.

It's not just older distributions. If the I/O schedulers are build in there wont be any block directory.

Quoted 6 lines

srp/001
srp/002
srp/013
srp/014

#2 lore raw
In reply to Luis Chamberlain
Quoted 19 lines · Luis Chamberlain

We currently fail if the following tests if the directory /lib/modules/$(uname -r)/kernel/block does not exist. Just make this optional. Older distributions won't have this directory.

srp/001
srp/002
srp/013
srp/014

---
 common/multipath-over-rdma | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
common/multipath-over-rdma +0 -0
index 676d283..f004124 100644

common/multipath-over-rdma setup_test() { · line 701

Quoted 10 lines
common/multipath-over-rdma +3 -4
@@ -696,10 +696,13 @@ setup_test() {
 
 	# Load the I/O scheduler kernel modules
 	(
-		cd "/lib/modules/$(uname -r)/kernel/block" &&
-			for m in *.ko; do
-				[ -e "$m" ] && modprobe "${m%.ko}"
-			done
+		KERNEL_BLOCK="/lib/modules/$(uname -r)/kernel/block"
+		if [ -d $KERNEL_BLOCK ]; then
+			cd $KERNEL_BLOCK &&

This has a couple of shellcheck errors about unquoted variables. Fixed those up and applied, thanks.

Quoted 10 lines
common/multipath-over-rdma +4 -0
+				for m in *.ko; do
+					[ -e "$m" ] && modprobe "${m%.ko}"
+				done
+		fi
 	)
 
 	if [ -d /sys/kernel/debug/dynamic_debug ]; then
Signature · 1 line
2.27.0