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

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