[dm-devel] [PATCH] kpartx.rules: skip MD devices

Benjamin Marzinski bmarzins at redhat.com
Mon Feb 7 21:16:41 UTC 2022


On Mon, Feb 07, 2022 at 06:18:19PM +0100, mwilck at suse.com wrote:
> From: Martin Wilck <mwilck at 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 at suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins at 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




More information about the dm-devel mailing list