[PATCH 2/2] udev: Work around race condition on array activation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When an array is activated, it is possible for the md/array_state property to be "clean",
while the array is not accessible. This leads to a situation where systemd is told to
activate the block device unit while it is not ready yet.

This causes a race condition in combination with the LVM2 udev rules: Since ID_FS_TYPE is not
set yet, LVM2 does not look at the device. When a change event occurs later, ID_FS_TYPE is set
to LVM2_member and LVM2 sets SYSTEMD_WANTS to call a service to activate the LVM volume.
However, systemd has already activated the device at that time and the change to SYSTEMD_WANTS
is ignored.

To solve this, in addition to checking md/array_state, also check the size property: If size
is 0, the array is not ready and should not be treated as such.
---
 udev-md-raid-arrays.rules | 1 +
 1 file changed, 1 insertion(+)

diff --git a/udev-md-raid-arrays.rules b/udev-md-raid-arrays.rules
index 90d1aa5..08f3cad 100644
--- a/udev-md-raid-arrays.rules
+++ b/udev-md-raid-arrays.rules
@@ -15,6 +15,7 @@ ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
 ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
 TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
 ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
+ATTR{size}=="0", ENV{SYSTEMD_READY}="0", GOTO="md_end"
 LABEL="md_ignore_state"
 
 ENV{SYSTEMD_READY}="1"
-- 
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux