Blame SOURCES/0079-mdadm-udev-Don-t-handle-change-event-on-raw-devices.patch

91179e
From 24d329fc97a64ec185ef27e59730f3f058c09029 Mon Sep 17 00:00:00 2001
91179e
From: Xiao Ni <xni@redhat.com>
91179e
Date: Thu, 5 Jan 2023 00:29:20 +0800
91179e
Subject: [PATCH 79/83] mdadm/udev: Don't handle change event on raw devices
91179e
91179e
The raw devices are ready when add event happpens and the raid
91179e
can be assembled. So there is no need to handle change events.
91179e
And it can cause some inconvenient problems.
91179e
91179e
For example, the OS is installed on md0(/root) and md1(/home).
91179e
md0 and md1 are created on partitions. When it wants to re-install
91179e
OS, anaconda can't clear the storage configure. It deletes one
91179e
partition and does some jobs. The change event happens. Now
91179e
the raid device is assembled again. It can't delete the other
91179e
partitions.
91179e
91179e
So in this patch, we don't handle change event on raw devices
91179e
anymore.
91179e
91179e
Signed-off-by: Xiao Ni <xni@redhat.com>
91179e
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
91179e
---
91179e
 udev-md-raid-assembly.rules | 8 ++++++++
91179e
 1 file changed, 8 insertions(+)
91179e
91179e
diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules
91179e
index 39b4344b..d4a7f0a5 100644
91179e
--- a/udev-md-raid-assembly.rules
91179e
+++ b/udev-md-raid-assembly.rules
91179e
@@ -11,6 +11,11 @@ SUBSYSTEM!="block", GOTO="md_inc_end"
91179e
 ENV{SYSTEMD_READY}=="0", GOTO="md_inc_end"
91179e
 
91179e
 # handle potential components of arrays (the ones supported by md)
91179e
+# For member devices which are md/dm devices, we don't need to
91179e
+# handle add event. Because md/dm devices need to do some init jobs.
91179e
+# Then the change event happens.
91179e
+# When adding md/dm devices, ID_FS_TYPE can only be linux_raid_member
91179e
+# after change event happens.
91179e
 ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_inc"
91179e
 
91179e
 # "noiswmd" on kernel command line stops mdadm from handling
91179e
@@ -28,6 +33,9 @@ GOTO="md_inc_end"
91179e
 
91179e
 LABEL="md_inc"
91179e
 
91179e
+# Bare disks are ready when add event happens, the raid can be assembled.
91179e
+ACTION=="change", KERNEL!="dm-*|md*", GOTO="md_inc_end"
91179e
+
91179e
 # remember you can limit what gets auto/incrementally assembled by
91179e
 # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
91179e
 ACTION!="remove", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
91179e
-- 
91179e
2.38.1
91179e