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