Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 1/1] mdadm/udev: Don't handle change event on raw devices
@ 2023-01-04 16:29 Xiao Ni
  2023-01-04 23:38 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Ni @ 2023-01-04 16:29 UTC (permalink / raw)
  To: jes; +Cc: pmenzel, ncroxon, linux-raid

The raw devices are ready when add event happpens and the raid
can be assembled. So there is no need to handle change events.
And it can cause some inconvenient problems.

For example, the OS is installed on md0(/root) and md1(/home).
md0 and md1 are created on partitions. When it wants to re-install
OS, anaconda can't clear the storage configure. It deletes one
partition and does some jobs. The change event happens. Now
the raid device is assembled again. It can't delete the other
partitions.

So in this patch, we don't handle change event on raw devices
anymore.

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 udev-md-raid-assembly.rules | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules
index 39b4344b8592..d4a7f0a5a049 100644
--- a/udev-md-raid-assembly.rules
+++ b/udev-md-raid-assembly.rules
@@ -11,6 +11,11 @@ SUBSYSTEM!="block", GOTO="md_inc_end"
 ENV{SYSTEMD_READY}=="0", GOTO="md_inc_end"
 
 # handle potential components of arrays (the ones supported by md)
+# For member devices which are md/dm devices, we don't need to
+# handle add event. Because md/dm devices need to do some init jobs.
+# Then the change event happens.
+# When adding md/dm devices, ID_FS_TYPE can only be linux_raid_member
+# after change event happens.
 ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_inc"
 
 # "noiswmd" on kernel command line stops mdadm from handling
@@ -28,6 +33,9 @@ GOTO="md_inc_end"
 
 LABEL="md_inc"
 
+# Bare disks are ready when add event happens, the raid can be assembled.
+ACTION=="change", KERNEL!="dm-*|md*", GOTO="md_inc_end"
+
 # remember you can limit what gets auto/incrementally assembled by
 # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
 ACTION!="remove", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
-- 
2.32.0 (Apple Git-132)


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

* Re: [PATCH v2 1/1] mdadm/udev: Don't handle change event on raw devices
  2023-01-04 16:29 [PATCH v2 1/1] mdadm/udev: Don't handle change event on raw devices Xiao Ni
@ 2023-01-04 23:38 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2023-01-04 23:38 UTC (permalink / raw)
  To: Xiao Ni; +Cc: pmenzel, ncroxon, linux-raid

On 1/4/23 11:29, Xiao Ni wrote:
> The raw devices are ready when add event happpens and the raid
> can be assembled. So there is no need to handle change events.
> And it can cause some inconvenient problems.
> 
> For example, the OS is installed on md0(/root) and md1(/home).
> md0 and md1 are created on partitions. When it wants to re-install
> OS, anaconda can't clear the storage configure. It deletes one
> partition and does some jobs. The change event happens. Now
> the raid device is assembled again. It can't delete the other
> partitions.
> 
> So in this patch, we don't handle change event on raw devices
> anymore.
> 
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
>  udev-md-raid-assembly.rules | 8 ++++++++
>  1 file changed, 8 insertions(+)

Applied!

Thanks,
Jes



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

end of thread, other threads:[~2023-01-04 23:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 16:29 [PATCH v2 1/1] mdadm/udev: Don't handle change event on raw devices Xiao Ni
2023-01-04 23:38 ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox