[dm-devel] [PATCH 3/3] multipathd: trigger udev change on path addition

Benjamin Marzinski bmarzins at redhat.com
Tue Jan 18 03:27:33 UTC 2022


When a multipath device is created for the first time, there is a window
where some path devices way be added to the multipath device, but never
claimed in udev. This can allow other device owners, like lvm, to think
they can use the device.

When a multipath device is first created, all the existing paths that
are not claimed by multipath have a uevent triggered so that they can
get claimed. After that, multipath assumes all future paths added to the
multipath device will have been claimed by multipath, since the device's
WWID is now in the wwids file.  This doesn't work for any paths that
have already been processed by the multipath.rules udev rules before
the multipath device was created.

To close this window, when path device is added, and a matching
multipath device already exists, multipathd now checks if the device is
claimed by multipath, and if not, triggers a uevent to claim it.

Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
---
 libmultipath/libmultipath.version | 1 +
 multipathd/main.c                 | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index d8cee0c3..b663cb29 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -210,6 +210,7 @@ global:
 	sysfs_is_multipathed;
 	timespeccmp;
 	timespecsub;
+	trigger_path_udev_change;
 	trigger_paths_udev_change;
 	truncate_strbuf;
 	udev;
diff --git a/multipathd/main.c b/multipathd/main.c
index c241dad5..44ca5b12 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1157,6 +1157,8 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
 		free_path(pp);
 		return 1;
 	}
+	if (mpp)
+		trigger_path_udev_change(pp, true);
 	if (mpp && mpp->wait_for_udev &&
 	    (pathcount(mpp, PATH_UP) > 0 ||
 	     (pathcount(mpp, PATH_GHOST) > 0 &&
-- 
2.17.2




More information about the dm-devel mailing list