device-mapper-multipath/0145-multipathd-improve-getting-parent-udevice-in-rescan_.patch

41 lines
1.2 KiB
Diff
Raw Normal View History

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