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

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