Skip to contentSkip to conversation

11-dm-mpath.rules: Disable blkid runs when updating the device

RFC PATCH In review Benjamin Marzinski 2 participants 2 messages Oct 22, 2024 – Nov 3, 2024 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

RFC PATCH 1/1 11-dm-mpath.rules: Disable blkid runs when updating the device

When multipath reloads a device or fails or restores a path, the udev rules disable LVM scanning, but since .DM_NOSCAN isn't set, blkid is still run on the device. When multipath devices that are set to queue_if_no_path lose all their paths at close to the same time, udev workers can hang trying to run blkid. The blkid results shouldn't change when multipathd is adding, removing, failing or reinstating paths, aside from avoiding hanging udev processes, we're skipping unnecessary work.

---
 multipath/11-dm-mpath.rules.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
multipath/11-dm-mpath.rules.in +3 -3
index 30647b99..6a76a348 100644
@@ -80,12 +80,12 @@ ENV{DM_COLDPLUG_SUSPENDED}=="1", ENV{.DM_SUSPENDED}!="1", \
 # It's exactly mpath's job to provide *seamless* device access to any of the
 # paths that are available underneath.
 ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", \
-	ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1"
+	ENV{DM_ACTIVATION}="0", ENV{.DM_NOSCAN}="1", ENV{MPATH_UNCHANGED}="1"
 
 # For path failed or reinstated events, unset DM_ACTIVATION.
 # This is similar to the DM_SUBSYSTEM_UDEV_FLAG0 case above.
 ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", \
-	ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1"
+	ENV{DM_ACTIVATION}="0", ENV{.DM_NOSCAN}="1", ENV{MPATH_UNCHANGED}="1"
 
 LABEL="check_mpath_ready"
 
@@ -113,7 +113,7 @@ LABEL="mpath_is_ready"
 ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="scan_import"
 ENV{.DM_SUSPENDED}=="1", ENV{MPATH_DEVICE_READY}="0", GOTO="scan_import"
 
-ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0"
+ENV{DM_ACTIVATION}="1", ENV{.DM_NOSCAN}="0", ENV{MPATH_UNCHANGED}="0"
 
 # The code to check multipath state ends here. We need to set
 # properties and symlinks regardless whether the map is usable or
Signature · 1 line
2.46.2
#1 lore raw
Quoted 9 lines · Benjamin Marzinski

When multipath reloads a device or fails or restores a path, the udev rules disable LVM scanning, but since .DM_NOSCAN isn't set, blkid is still run on the device. When multipath devices that are set to queue_if_no_path lose all their paths at close to the same time, udev workers can hang trying to run blkid. The blkid results shouldn't change when multipathd is adding, removing, failing or reinstating paths, aside from avoiding hanging udev processes, we're skipping unnecessary work.

Quoted 4 lines

---
 multipath/11-dm-mpath.rules.in | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)

This is correct. It conflicts with my own late udev rule patch set. While your patch was sent first, I believe it makes more sense to apply this change after mine.

I'll to send a v2 with the .DM_NOSCAN logic improved.

Regards
Martin