dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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