Skip to contentSkip to conversation

11-dm-mpath.rules: dont't run "multipath -U" during coldplug

PATCH In review Martin Wilck 2 participants 2 messages Apr 6, 2018 – Apr 12, 2018 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 11-dm-mpath.rules: dont't run "multipath -U" during coldplug

When udevadm trigger is run after switching root, lots of simultaneous uevents for both path and multipath devices arrive. In may happen that when "multipath -U" is called on a dm device, the path's uevents haven't finished yet, thus the paths aren't found in the udev db, and multipath -U erroneously concludes that there are no usable paths. Avoid that by skipping "multipath -U" during coldplug.

Fixes "ce5ea6a 11-dm-mpath.rules: multipath -U for READY check"
---
 multipath/11-dm-mpath.rules | 4 ++++
 1 file changed, 4 insertions(+)
multipath/11-dm-mpath.rules +4 -0
index 03ac5da..07320a1 100644
@@ -26,6 +26,10 @@ ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
 ENV{MPATH_SBIN_PATH}="/sbin"
 TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
 
+# Don't run multipath -U during "coldplug" after switching root,
+# because paths are just being added to the udev db.
+ACTION=="add", ENV{.MPATH_DEVICE_READY_OLD}=="1", GOTO="paths_ok"
+
 # Check the map state directly with multipath -U.
 # This doesn't attempt I/O on the device.
 PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -U %k", GOTO="paths_ok"
Signature · 1 line
2.16.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Martin Wilck

When udevadm trigger is run after switching root, lots of simultaneous uevents for both path and multipath devices arrive. In may happen that when "multipath -U" is called on a dm device, the path's uevents haven't finished yet, thus the paths aren't found in the udev db, and multipath -U erroneously concludes that there are no usable paths. Avoid that by skipping "multipath -U" during coldplug.

Quoted 23 lines
Fixes "ce5ea6a 11-dm-mpath.rules: multipath -U for READY check"
---
 multipath/11-dm-mpath.rules | 4 ++++
 1 file changed, 4 insertions(+)
multipath/11-dm-mpath.rules +4 -0
index 03ac5da..07320a1 100644
@@ -26,6 +26,10 @@ ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
 ENV{MPATH_SBIN_PATH}="/sbin"
 TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
 
+# Don't run multipath -U during "coldplug" after switching root,
+# because paths are just being added to the udev db.
+ACTION=="add", ENV{.MPATH_DEVICE_READY_OLD}=="1", GOTO="paths_ok"
+
 # Check the map state directly with multipath -U.
 # This doesn't attempt I/O on the device.
 PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -U %k", GOTO="paths_ok"
Signature · 1 line
2.16.1