Blame SOURCES/0070-multipathd-improve-getting-parent-udevice-in-rescan_.patch

b46d12
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b46d12
From: Benjamin Marzinski <bmarzins@redhat.com>
b46d12
Date: Thu, 25 Mar 2021 19:52:45 -0500
b46d12
Subject: [PATCH] multipathd: improve getting parent udevice in rescan_path
b46d12
b46d12
Instead of looping through parents and checking, just call
b46d12
udev_device_get_parent_with_subsystem_devtype() to get the
b46d12
right one.
b46d12
b46d12
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b46d12
Reviewed-by: Martin Wilck <mwilck@suse.com>
b46d12
---
b46d12
 multipathd/main.c | 14 +++++---------
b46d12
 1 file changed, 5 insertions(+), 9 deletions(-)
b46d12
b46d12
diff --git a/multipathd/main.c b/multipathd/main.c
b46d12
index 1fbc31eb..4598d354 100644
b46d12
--- a/multipathd/main.c
b46d12
+++ b/multipathd/main.c
b46d12
@@ -823,16 +823,12 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs)
b46d12
 }
b46d12
 
b46d12
 static void
b46d12
-rescan_path(struct udev_device *parent)
b46d12
+rescan_path(struct udev_device *ud)
b46d12
 {
b46d12
-	while(parent) {
b46d12
-		const char *subsys = udev_device_get_subsystem(parent);
b46d12
-		if (subsys && !strncmp(subsys, "scsi", 4))
b46d12
-			break;
b46d12
-		parent = udev_device_get_parent(parent);
b46d12
-	}
b46d12
-	if (parent)
b46d12
-		sysfs_attr_set_value(parent, "rescan", "1", strlen("1"));
b46d12
+	ud = udev_device_get_parent_with_subsystem_devtype(ud, "scsi",
b46d12
+							   "scsi_device");
b46d12
+	if (ud)
b46d12
+		sysfs_attr_set_value(ud, "rescan", "1", strlen("1"));
b46d12
 }
b46d12
 
b46d12
 void
b46d12
-- 
b46d12
2.17.2
b46d12