]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
udev: Fix order of execution of the md rules
authorThomas Bächler <thomas@archlinux.org>
Sat, 9 Feb 2013 20:49:47 +0000 (21:49 +0100)
committerNeilBrown <neilb@suse.de>
Mon, 11 Feb 2013 00:15:34 +0000 (11:15 +1100)
Right now, the rules that run blkid on raid arrays are executed after
the assembly rules. This means incremental assembly will always fail
when raid arrays are again physical components of raid arrays.

Instead of simply reversing the order, split the rules up into two files,
one dealing with array properties and one dealing with assembly.

Signed-off-by: NeilBrown <neilb@suse.de>
Makefile
udev-md-raid-arrays.rules [moved from udev-md-raid.rules with 75% similarity]
udev-md-raid-assembly.rules [new file with mode: 0644]

index b6edb23d4f03c520759030a203c0ec5e5427105d..ad0819d39bc3977da9646fdac92e3e0bf6937dca 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -262,8 +262,9 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
        $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
        $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
 
-install-udev: udev-md-raid.rules
-       $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)$(UDEVDIR)/rules.d/64-md-raid.rules
+install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules
+       $(INSTALL) -D -m 644 udev-md-raid-arrays.rules $(DESTDIR)$(UDEVDIR)/rules.d/63-md-raid-arrays.rules
+       $(INSTALL) -D -m 644 udev-md-raid-assembly.rules $(DESTDIR)$(UDEVDIR)/rules.d/64-md-raid-assembly.rules
 
 install-systemd: systemd/mdmon@.service
        $(INSTALL) -D -m 644 systemd/mdmon@.service $(DESTDIR)$(SYSTEMD_DIR)/mdmon@.service
similarity index 75%
rename from udev-md-raid.rules
rename to udev-md-raid-arrays.rules
index ea97261bf59697c43b10fcc9cea073cee26bb694..0540ed80d623ea7a395d7381f429f2f15fa25ce9 100644 (file)
@@ -2,20 +2,6 @@
 
 SUBSYSTEM!="block", GOTO="md_end"
 
-# handle potential components of arrays (the ones supported by md)
-ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc"
-GOTO="md_inc_skip"
-
-LABEL="md_inc"
-
-# remember you can limit what gets auto/incrementally assembled by
-# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
-ACTION=="add", RUN+="/sbin/mdadm --incremental $devnode --offroot"
-ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
-ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
-
-LABEL="md_inc_skip"
-
 # handle md arrays
 ACTION!="add|change", GOTO="md_end"
 KERNEL!="md*", GOTO="md_end"
diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules
new file mode 100644 (file)
index 0000000..b653265
--- /dev/null
@@ -0,0 +1,19 @@
+# do not edit this file, it will be overwritten on update
+
+# assemble md arrays
+
+SUBSYSTEM!="block", GOTO="md_inc_end"
+
+# handle potential components of arrays (the ones supported by md)
+ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc"
+GOTO="md_inc_end"
+
+LABEL="md_inc"
+
+# remember you can limit what gets auto/incrementally assembled by
+# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
+ACTION=="add", RUN+="/sbin/mdadm --incremental $devnode --offroot"
+ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
+
+LABEL="md_inc_end"