Skip to contentSkip to conversation

kpartx.rules: skip MD devices

PATCH In review [email protected] 2 participants 2 messages Feb 8, 2022 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kpartx.rules: skip MD devices

From: Martin Wilck <[email protected]>

With the mdadm metadata format v1.0 (and DDF), the MD superblock is at the end of the device, keeping the partition table at the beginning. This may cause wrong partition mappings to be created by kpartx on RAID component devices.

So far I've only seen ugly error messages, but at least in principle it can happen that kpartx wins a race with MD, and prevents correct setup of the MD device.

Sample error messages:

[    4.029490] systemd-udevd[445]: dm-0: '/sbin/kpartx -un -p -part /dev/dm-0'(err) 'device-mapper: reload ioctl on 3600140508dbcf02acb448188d73ec97d-part1  failed: Device or resource busy'
[    4.075666] kernel: device-mapper: table: 254:1: linear: Device lookup failed
[    4.075945] kernel: device-mapper: ioctl: error adding target to table

Skip creating partition mappings on MD components.

---
 kpartx/kpartx.rules | 3 +++
 1 file changed, 3 insertions(+)
kpartx/kpartx.rules +3 -0
index d7527d7..1969dee 100644
@@ -12,6 +12,9 @@ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="kpartx_end"
 # Create dm tables for partitions on multipath devices.
 ENV{DM_UUID}!="mpath-?*", GOTO="mpath_kpartx_end"
 
+# Ignore RAID members
+ENV{ID_FS_TYPE}=="linux_raid_member|isw_raid_member|ddf_raid_member", 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:
 # - "change" events with DM_ACTIVATION!="1" (e.g. partition table changes)
Signature · 7 lines
2.34.1


--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · On Mon, Feb 07, 2022 at 06:18:19PM +0100, [email protected] wrote:

From: Martin Wilck <[email protected]>

With the mdadm metadata format v1.0 (and DDF), the MD superblock is at the end of the device, keeping the partition table at the beginning. This may cause wrong partition mappings to be created by kpartx on RAID component devices.

So far I've only seen ugly error messages, but at least in principle it can happen that kpartx wins a race with MD, and prevents correct setup of the MD device.

Sample error messages:

Quoted 7 lines
[    4.029490] systemd-udevd[445]: dm-0: '/sbin/kpartx -un -p -part /dev/dm-0'(err) 'device-mapper: reload ioctl on 3600140508dbcf02acb448188d73ec97d-part1  failed: Device or resource busy'
[    4.075666] kernel: device-mapper: table: 254:1: linear: Device lookup failed
[    4.075945] kernel: device-mapper: ioctl: error adding target to table

Skip creating partition mappings on MD components.

Quoted 20 lines
---
 kpartx/kpartx.rules | 3 +++
 1 file changed, 3 insertions(+)
kpartx/kpartx.rules +3 -0
index d7527d7..1969dee 100644
@@ -12,6 +12,9 @@ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="kpartx_end"
 # Create dm tables for partitions on multipath devices.
 ENV{DM_UUID}!="mpath-?*", GOTO="mpath_kpartx_end"
 
+# Ignore RAID members
+ENV{ID_FS_TYPE}=="linux_raid_member|isw_raid_member|ddf_raid_member", 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:
 # - "change" events with DM_ACTIVATION!="1" (e.g. partition table changes)
Signature · 1 line
2.34.1

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel