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

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