dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0041-udev-allow-for-udev-attribute-reading-bug.patch

5d5466
From 7bd59e7926c6921121087eb067befaa896c900a4 Mon Sep 17 00:00:00 2001
5d5466
From: NeilBrown <neilb@suse.de>
5d5466
Date: Wed, 18 Sep 2019 15:12:55 +1000
5d5466
Subject: [RHEL7.8 PATCH V2 41/47] udev: allow for udev attribute reading bug.
5d5466
5d5466
There is a bug in udev (which will hopefully get fixed, but
5d5466
we should allow for it anways).
5d5466
When reading a sysfs attribute, it first reads the whole
5d5466
value of the attribute, then reads again expecting to get
5d5466
a read of 0 bytes, like you would with an ordinary file.
5d5466
If the sysfs attribute changed between these two reads, it can
5d5466
get a mixture of two values.
5d5466
5d5466
In particular, if it reads when 'array_state' is changing from
5d5466
'clear' to 'inactive', it can find the value as "clear\nve".
5d5466
5d5466
This causes the test for "|clear|active" to fail, so systemd is allowed
5d5466
to think that the array is ready - when it isn't.
5d5466
5d5466
So change the pattern to allow for this but adding a wildcard at
5d5466
the end.
5d5466
Also don't allow for an empty string - reading array_state will
5d5466
never return an empty string - if it exists at all, it will be
5d5466
non-empty.
5d5466
5d5466
Signed-off-by: NeilBrown <neilb@suse.de>
5d5466
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
5d5466
---
5d5466
 udev-md-raid-arrays.rules | 2 +-
5d5466
 1 file changed, 1 insertion(+), 1 deletion(-)
5d5466
5d5466
diff --git a/udev-md-raid-arrays.rules b/udev-md-raid-arrays.rules
5d5466
index d391665..c8fa8e8 100644
5d5466
--- a/udev-md-raid-arrays.rules
5d5466
+++ b/udev-md-raid-arrays.rules
5d5466
@@ -14,7 +14,7 @@ ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
5d5466
 # never leave state 'inactive'
5d5466
 ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
5d5466
 TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
5d5466
-ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
5d5466
+ATTR{md/array_state}=="clear*|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
5d5466
 LABEL="md_ignore_state"
5d5466
 
5d5466
 IMPORT{program}="BINDIR/mdadm --detail --no-devices --export $devnode"
5d5466
-- 
5d5466
2.7.5
5d5466