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

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