diff mbox series

kpartx.rules: skip MD devices

Message ID 20220207171819.7091-1-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series kpartx.rules: skip MD devices | expand

Commit Message

Martin Wilck Feb. 7, 2022, 5:18 p.m. UTC
From: Martin Wilck <mwilck@suse.com>

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.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 kpartx/kpartx.rules | 3 +++
 1 file changed, 3 insertions(+)

Comments

Benjamin Marzinski Feb. 7, 2022, 9:16 p.m. UTC | #1
On Mon, Feb 07, 2022 at 06:18:19PM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> 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.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  kpartx/kpartx.rules | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
> index d7527d7..1969dee 100644
> --- a/kpartx/kpartx.rules
> +++ b/kpartx/kpartx.rules
> @@ -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)
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index d7527d7..1969dee 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -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)