Skip to contentSkip to conversation

udev-rules: prevent systemd from mount devices before they are ready.

PATCH Applied [email protected] 2 participants 2 messages Jul 31, 2012 – Aug 2, 2012 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udev-rules: prevent systemd from mount devices before they are ready.

From: Harald Hoyer <[email protected]>

In the "add" uevent, ATTR{md/array_state} does not exist, so the next rule does not kick in.

When an array is assembled incrementally, systemd might see it before it is ready, try to mount it, fail, and give up. Result is that array doesn't get mounted.

If we ask udev to tell systemd that it isn't ready yet in this case, systemd waits until it is ready, and all are happy.

---
 udev-md-raid.rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
udev-md-raid.rules +1 -1
index 814c897..da9d3c5 100644
@@ -27,7 +27,7 @@ ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
 # container devices have a metadata version of e.g. 'external:ddf' and
 # never leave state 'inactive'
 ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
-TEST!="md/array_state", GOTO="md_end"
+TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
 ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
 LABEL="md_ignore_state"
 
Signature · 1 line
1.7.11.2
Applied
#1 lore raw
Quoted 20 lines · On Tue, 31 Jul 2012 10:53:47 +0200 [email protected] wrote:

From: Harald Hoyer <[email protected]>

In the "add" uevent, ATTR{md/array_state} does not exist, so the next rule does not kick in.

When an array is assembled incrementally, systemd might see it before it is ready, try to mount it, fail, and give up. Result is that array doesn't get mounted.

If we ask udev to tell systemd that it isn't ready yet in this case, systemd waits until it is ready, and all are happy.

---
 udev-md-raid.rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
udev-md-raid.rules +0 -0
index 814c897..da9d3c5 100644

udev-md-raid.rules ENV{DEVTYPE}=="partition", GOTO="md_ignore_state" · line 33

Quoted 8 lines
udev-md-raid.rules +1 -1
@@ -27,7 +27,7 @@ ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
 # container devices have a metadata version of e.g. 'external:ddf' and
 # never leave state 'inactive'
 ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
-TEST!="md/array_state", GOTO="md_end"
+TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
 ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
 LABEL="md_ignore_state"
 

Thanks!

applied.

NeilBrown