All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [PATCH] kpartx.rules: skip MD devices
@ 2022-02-07 17:18 mwilck
  2022-02-07 21:16 ` Benjamin Marzinski
  0 siblings, 1 reply; 2+ messages in thread
From: mwilck @ 2022-02-07 17:18 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

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(+)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [dm-devel] [PATCH] kpartx.rules: skip MD devices
  2022-02-07 17:18 [dm-devel] [PATCH] kpartx.rules: skip MD devices mwilck
@ 2022-02-07 21:16 ` Benjamin Marzinski
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Marzinski @ 2022-02-07 21:16 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-08 22:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 17:18 [dm-devel] [PATCH] kpartx.rules: skip MD devices mwilck
2022-02-07 21:16 ` Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.