90mdraid/65-md-incremental-imsm.rules: first set initqueue-finished,
authorHarald Hoyer <harald@redhat.com>
Tue, 15 Sep 2009 09:13:47 +0000 (11:13 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 15 Sep 2009 13:00:25 +0000 (15:00 +0200)
then initqueue-settled

also introduce md_finished.sh to check for all md activity to be settled

modules.d/90mdraid/65-md-incremental-imsm.rules
modules.d/90mdraid/install
modules.d/90mdraid/md_finished.sh [new file with mode: 0644]
modules.d/90mdraid/mdcontainer_start.sh
modules.d/90mdraid/mdraid_start.sh

index ca0ac70..604185c 100644 (file)
@@ -18,22 +18,35 @@ TEST=="/tmp/.mdraid_container-%k", GOTO="md_inc_end"
 
 KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
 
-
 # UUID CHECK
 
 LABEL="do_md_inc"
 
-ENV{rd_MDADMCONF}=="?*", \
-       RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto", \
-        RUN+="/bin/sh -c 'echo return 1 > /initqueue-finished/mdraid.sh'", \
-        GOTO="md_inc_end"
+# 
+# if rd_MDADMCONF do not assemble incrementally
+# defer auto assembly until the udev queue is settled
+# 
+ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
+
+ACTION=="change", \
+        RUN+="/bin/sh -c '>/tmp/.mdraid_auto-%k'"
+
+TEST!="/tmp/.mdraid_auto-%k", \
+       RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
 
+GOTO="md_inc_end"
+
+LABEL="md_auto_end"
+
+#
+# Incrementally build the md array
+#
 RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}"
 
 ACTION=="change", \
        RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k'" 
 
-RUN+="/bin/sh -c 'echo return 1 > /initqueue-finished/mdraid.sh'"
+RUN+="/bin/ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh"
 
 LABEL="md_inc_end"
 
@@ -53,8 +66,7 @@ GOTO="end_raidstart"
 LABEL="do_raidstart"
 
 TEST!="/tmp/.mdraid_start-%k", \
-       RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start", \
-        RUN+="/bin/sh -c 'echo return 1 > /initqueue-finished/mdraid.sh'"
+        RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
 
 ACTION=="change", \
        RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k'"
@@ -77,8 +89,7 @@ GOTO="end_container"
 LABEL="do_container"
 
 TEST!="/tmp/.mdcontainer_start-%k", \
-       RUN+="/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}", \
-        RUN+="/bin/sh -c 'echo return 1 > /initqueue-finished/mdraid.sh'"
+        RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
 
 ACTION=="change", \
        RUN+="/bin/sh -c '>/tmp/.mdcontainer_start-%k'"
index 84ab240..23a8fe4 100755 (executable)
@@ -34,6 +34,7 @@ fi
 inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
 inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start
 inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
+inst "$moddir/md_finished.sh" /sbin/md_finished.sh
 inst_hook pre-trigger 30 "$moddir/parse-md.sh"
 inst_hook pre-pivot 30 "$moddir/mdraid-cleanup.sh"
 inst_hook pre-pivot 31 "$moddir/mdraid-cleanup.sh"
diff --git a/modules.d/90mdraid/md_finished.sh b/modules.d/90mdraid/md_finished.sh
new file mode 100644 (file)
index 0000000..0958251
--- /dev/null
@@ -0,0 +1,7 @@
+for f in /initqueue-settled/mdcontainer_start* /initqueue-settled/mdraid_start* /initqueue-settled/mdadm_auto*; do
+    [ -e $f ] && return 1
+done
+
+$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || return 1
+
+return 0
index 6043dc8..f08647d 100755 (executable)
@@ -5,5 +5,4 @@ md=$1
 udevadm control --stop-exec-queue
 # and activate any containers
 mdadm -IR $md 2>&1 | vinfo
-[ -f /initqueue-settled/mdraid_start ] || rm /initqueue-finished/mdraid.sh 2>/dev/null
 udevadm control --start-exec-queue
index 8a1e063..ab45986 100755 (executable)
@@ -5,5 +5,4 @@
 info "Assembling MD RAID arrays"
 udevadm control --stop-exec-queue
 mdadm -IRs 2>&1 | vinfo
-[ -f /initqueue-settled/mdcontainer_start ] || rm /initqueue-finished/mdraid.sh 2>/dev/null
 udevadm control --start-exec-queue