Skip to contentSkip to conversation

kpartx.rules: check for skip_kpartx if DM_ACTIVATION is unset

PATCH New [email protected] 1 participant 1 message Apr 2, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kpartx.rules: check for skip_kpartx if DM_ACTIVATION is unset

From: Martin Wilck <[email protected]>

The current test to detect "spurious" uevents, and thus whether to import DM_SUBSYSTEM_UDEV_FLAG1 (the flag for the "skip_kpartx" option) from the udev db is wrong. In 10-dm.rules, DM_UDEV_PRIMARY_SOURCE_FLAG is imported from the db if it isn't set, meaning that it's always 1 for active maps. The only events for which DM_SUBSYSTEM_UDEV_FLAG1 must not be loaded from the db are the real "primary" events, which have DM_ACTIVATION=="1".

11-dm-mpath.rules resets DM_ACTIVATION to 0 if nothing should change in upper layers. In this case importing DM_SUBSYSTEM_UDEV_FLAG1 is correct, too. kpartx will not be called anyway, because 11-dm-mpath.rules also sets MPATH_UNCHANGED=1.

---
 kpartx/kpartx.rules | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kpartx/kpartx.rules +3 -1
index 8f990494..3c6be9f5 100644
@@ -13,7 +13,9 @@ ENV{DM_UUID}!="mpath-?*", GOTO="mpath_kpartx_end"
 
 # DM_SUBSYSTEM_UDEV_FLAG1 is the "skip_kpartx" flag.
 # For events not generated by libdevmapper, we need to fetch it from db.
-ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
+# Such events are identified by DM_ACTIVATION, not DM_UDEV_PRIMARY_SOURCE_FLAG,
+# because the latter is imported from the udev db (see 10-dm.rules)
+ENV{DM_ACTIVATION}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
 ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="mpath_kpartx_end"
 
 # 11-dm-mpath.rules sets MPATH_UNCHANGED for events that can be ignored.
Signature · 1 line
2.25.1