multipath.rules: fixup race condition with systemd
[multipath-tools/.git] / multipath / multipath.rules
index ac97749..c76e6b8 100644 (file)
@@ -1,7 +1,14 @@
-#
-# udev rules for multipathing.
-# The persistent symlinks are created with the kpartx rules
-#
+# Set DM_MULTIPATH_DEVICE_PATH if the device should be handled by multipath
+SUBSYSTEM!="block", GOTO="end_mpath"
 
-# socket for uevents
-SUBSYSTEM=="block", RUN+="socket:/org/kernel/dm/multipath_event"
+ENV{MPATH_SBIN_PATH}="/sbin"
+TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
+
+SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="sd*|dasd*", \
+       ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
+       PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -u %k", \
+       ENV{DM_MULTIPATH_DEVICE_PATH}="1" \
+       ENV{ID_FS_TYPE}="none" \
+       ENV{SYSTEMD_READY}="0"
+
+LABEL="end_mpath"