Skip to contentSkip to conversation

multipath udev rules changes for dm rules V3

PATCH In review Martin Wilck 3 participants 4 messages Apr 9, 2024 Device mapper

lore
Share & tools
lore
#0 lore raw

v3 cover multipath udev rules changes for dm rules V3

This patch set adapts the multipath rules to the pending changes for device mapper rules that update DM_UDEV_RULES_VSN to 3, and applies some additional clean-ups to the rules files.

Changes v2 -> v3:
* 08/11 replaced another UDEV_RULES_VSN test (Benjamin Marzinski)

(not resending the patches that have already been acked by Ben).

Changes v1 -> v2:

All changes suggested by Benjamin Marzinski except the last one.

* multiple patches: check DM_UDEV_RULES_VSN agains "1|2" rather than "3".
* 01/11: this patch was wrong as discussed, dropped code changes and added some comments instead, lest I make the same mistake again.
* 02/11: fix label name in comment to match an existing label
* 04/11: added missing "\" at end of line

Comments welcome.

Martin Wilck (12):
11-dm-mpath.rules: explain logic for device becoming ready while
suspended
11-dm-mpath.rules: don't import DM_NOSCAN from udev db 11-dm-mpath.rules: don't import ID_FS_VERSION from udev db 11-dm-mpath.rules: adapt MPATH_DEVICE_READY=0 logic to 10-dm.rules
update
11-dm-mpath.rules: adapt coldplug event handling ro 10-dm.rules update 11-dm-mpath.rules: don't import properties with new 13-dm-disk.rules 11-dm-mpath.rules: replace DM_SUSPENDED by .DM_SUSPENDED 11-dm-mpath.rules: replace DM_NOSCAN by .DM_NOSCAN 11-dm-mpath.rules: simplify PATH_FAILED case 11-dm-mpath.rules: make label names more intuitive kpartx.rules: ignore DM_SUSPENDED
multipath-tools tests: fix CI failures on arm/v7 with glibc 2.37

 kpartx/kpartx.rules            |  2 +-
 multipath/11-dm-mpath.rules.in | 86 ++++++++++++++++++++--------------
 tests/directio.c               | 22 ++++-----
 tests/vpd.c                    | 35 +++++++-------
 tests/wrap64.h                 | 23 ++++++++-
 5 files changed, 103 insertions(+), 65 deletions(-)
Signature · 1 line
2.44.0
#1 lore raw

PATCH v3 8/12 11-dm-mpath.rules: replace DM_NOSCAN by .DM_NOSCAN

We don't need to restore DM_NOSCAN from the db anymore, so we can rename it to .DM_NOSCAN, making it a temporary property.

---
 multipath/11-dm-mpath.rules.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
multipath/11-dm-mpath.rules.in +6 -3
index efc6416..3ae3c05 100644
@@ -96,14 +96,14 @@ ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready"
 # Do not initiate scanning if no path is available,
 # otherwise there would be a hang or IO error on access.
 # We'd like to avoid this, especially within udev processing.
-# This is communicated to later rules in DM_NOSCAN.
+# This is communicated to later rules in .DM_NOSCAN.
 # Likewise, skip all foreign rules if no path is available.
 # Use DM_UDEV_DISABLE_OTHER_RULES_FLAG to communicate this
 # to upper layers. With dm rules < v3, save the original value here;
 # it will be restored in a late udev rule.
 ENV{DM_UDEV_RULES_VSN}=="1|2", \
 	ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}"
-ENV{DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
+ENV{.DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
 GOTO="dont_activate"
 
 LABEL="mpath_is_ready"
@@ -134,7 +134,7 @@ ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="import_end"
 ENV{DM_UDEV_RULES_VSN}!="1|2", GOTO="import_end"
 
 # Don't import the properties from db if we will run blkid later.
-ENV{DM_NOSCAN}!="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="import_end"
+ENV{.DM_NOSCAN}!="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="import_end"
 
 IMPORT{db}="ID_FS_TYPE"
 IMPORT{db}="ID_FS_USAGE"
@@ -150,6 +150,9 @@ LABEL="import_end"
 # Reset previous DM_COLDPLUG_SUSPENDED if activation happens now
 ENV{.DM_SUSPENDED}!="1", ENV{DM_ACTIVATION}=="1", ENV{DM_COLDPLUG_SUSPENDED}=""
 
+# device-mapper rules v2 compatibility for 13-dm-disk.rules
+ENV{DM_UDEV_RULES_VSN}=="1|2", ENV{DM_NOSCAN}="$env{.DM_NOSCAN}"
+
 # Multipath maps should take precedence over their members.
 ENV{DM_UDEV_LOW_PRIORITY_FLAG}!="1", OPTIONS+="link_priority=50"
 
Signature · 1 line
2.44.0
maintainer Reviewed-by on v3 8/12
#2 lore raw

Re: [PATCH v3 08/12] 11-dm-mpath.rules: replace DM_NOSCAN by .DM_NOSCAN

Quoted 4 lines · Martin Wilck

We don't need to restore DM_NOSCAN from the db anymore, so we can rename it to .DM_NOSCAN, making it a temporary property.

Quoted 46 lines
---
 multipath/11-dm-mpath.rules.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
multipath/11-dm-mpath.rules.in +6 -3
index efc6416..3ae3c05 100644
@@ -96,14 +96,14 @@ ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready"
 # Do not initiate scanning if no path is available,
 # otherwise there would be a hang or IO error on access.
 # We'd like to avoid this, especially within udev processing.
-# This is communicated to later rules in DM_NOSCAN.
+# This is communicated to later rules in .DM_NOSCAN.
 # Likewise, skip all foreign rules if no path is available.
 # Use DM_UDEV_DISABLE_OTHER_RULES_FLAG to communicate this
 # to upper layers. With dm rules < v3, save the original value here;
 # it will be restored in a late udev rule.
 ENV{DM_UDEV_RULES_VSN}=="1|2", \
 	ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}"
-ENV{DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
+ENV{.DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
 GOTO="dont_activate"
 
 LABEL="mpath_is_ready"
@@ -134,7 +134,7 @@ ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="import_end"
 ENV{DM_UDEV_RULES_VSN}!="1|2", GOTO="import_end"
 
 # Don't import the properties from db if we will run blkid later.
-ENV{DM_NOSCAN}!="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="import_end"
+ENV{.DM_NOSCAN}!="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="import_end"
 
 IMPORT{db}="ID_FS_TYPE"
 IMPORT{db}="ID_FS_USAGE"
@@ -150,6 +150,9 @@ LABEL="import_end"
 # Reset previous DM_COLDPLUG_SUSPENDED if activation happens now
 ENV{.DM_SUSPENDED}!="1", ENV{DM_ACTIVATION}=="1", ENV{DM_COLDPLUG_SUSPENDED}=""
 
+# device-mapper rules v2 compatibility for 13-dm-disk.rules
+ENV{DM_UDEV_RULES_VSN}=="1|2", ENV{DM_NOSCAN}="$env{.DM_NOSCAN}"
+
 # Multipath maps should take precedence over their members.
 ENV{DM_UDEV_LOW_PRIORITY_FLAG}!="1", OPTIONS+="link_priority=50"
 
Signature · 1 line
2.44.0
#3 lore raw
In reply to Martin Wilck
Quoted 8 lines · Martin Wilck

This patch set adapts the multipath rules to the pending changes for device mapper rules that update DM_UDEV_RULES_VSN to 3, and applies some additional clean-ups to the rules files.

Changes v2 -> v3:
* 08/11 replaced another UDEV_RULES_VSN test (Benjamin Marzinski)

(not resending the patches that have already been acked by Ben)

There is no patch 12 in this series. Sorry for the mistake in the subject line.

Martin