[PATCH blktests] common/multipath-over-rdma: update is_rdma_device

Subsystems: the rest

STALE2064d

2 messages, 2 authors, 2021-01-21 · open the first message on its own page

[PATCH blktests] common/multipath-over-rdma: update is_rdma_device

From: Yi Zhang <hidden>
Date: 2021-01-21 00:29:41

Below patch make the siw/rxe device virtual in the device tree, update
is_rdma_device to match it.
a9d2e9ae953f RDMA/siw,rxe: Make emulated devices virtual in the device tree

Signed-off-by: Yi Zhang <redacted>
---
 common/multipath-over-rdma | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index 355b169..e4269f6 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -79,17 +79,24 @@ is_number() {
 # Check whether a device is an RDMA device. An example argument:
 # /sys/devices/pci0000:00/0000:00:03.0/0000:04:00.0
 is_rdma_device() {
-	local d i inode1 inode2
+	local d i f inode1 inode2
 
-	inode1=$(stat -c %i "$1")
-	# echo "inode1 = $inode1"
+	f=$1
+	inode1=$(stat -c %i "$f")
 	for i in /sys/class/infiniband/*; do
 		d=/sys/class/infiniband/"$(readlink "$i")"
-		d=$(dirname "$(dirname "$d")")
-		inode2=$(stat -c %i "$d")
-		# echo "inode2 = $inode2"
-		if [ "$inode1" = "$inode2" ]; then
-			return
+		if [[ "$d" == *"virtual"* ]]; then
+			if [[ -e "$d/parent" && "${f%%/*}" == "$(<"$d"/parent)" ]] || \
+				   [[ "${f%%/*}_siw" == "$(basename "$d")" ]]; then
+				return
+			fi
+		else
+			d1=$(dirname "$(dirname "$d")")
+			inode2=$(stat -c %i "$d1")
+			# echo "inode2 = $inode2"
+			if [ "$inode1" = "$inode2" ]; then
+				return
+			fi
 		fi
 	done
 	false
-- 
2.21.0

Re: [PATCH blktests] common/multipath-over-rdma: update is_rdma_device

From: Bart Van Assche <bvanassche@acm.org>
Date: 2021-01-21 04:06:27

On 1/20/21 3:18 PM, Yi Zhang wrote:
quoted hunk
Below patch make the siw/rxe device virtual in the device tree, update
is_rdma_device to match it.
a9d2e9ae953f RDMA/siw,rxe: Make emulated devices virtual in the device tree

Signed-off-by: Yi Zhang <redacted>
---
 common/multipath-over-rdma | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index 355b169..e4269f6 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -79,17 +79,24 @@ is_number() {
 # Check whether a device is an RDMA device. An example argument:
 # /sys/devices/pci0000:00/0000:00:03.0/0000:04:00.0
 is_rdma_device() {
-	local d i inode1 inode2
+	local d i f inode1 inode2
 
-	inode1=$(stat -c %i "$1")
-	# echo "inode1 = $inode1"
+	f=$1
+	inode1=$(stat -c %i "$f")
 	for i in /sys/class/infiniband/*; do
 		d=/sys/class/infiniband/"$(readlink "$i")"
-		d=$(dirname "$(dirname "$d")")
-		inode2=$(stat -c %i "$d")
-		# echo "inode2 = $inode2"
-		if [ "$inode1" = "$inode2" ]; then
-			return
+		if [[ "$d" == *"virtual"* ]]; then
+			if [[ -e "$d/parent" && "${f%%/*}" == "$(<"$d"/parent)" ]] || \
+				   [[ "${f%%/*}_siw" == "$(basename "$d")" ]]; then
+				return
+			fi
+		else
+			d1=$(dirname "$(dirname "$d")")
+			inode2=$(stat -c %i "$d1")
+			# echo "inode2 = $inode2"
+			if [ "$inode1" = "$inode2" ]; then
+				return
+			fi
 		fi
 	done
 	false
Jason Gunthorpe, the RDMA maintainer, asked some time ago to use rdma
link instead of inspecting /sys/class/infiniband to query rdma_rxe / siw
instance properties. Please take a look at the blktests patch that I
just posted and on which I cc-ed you.

Thanks,

Bart.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help