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

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