]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
90mdraid: wait for md devices to become clean
authorHarald Hoyer <harald@redhat.com>
Thu, 17 Nov 2011 09:14:23 +0000 (10:14 +0100)
committerHarald Hoyer <harald@redhat.com>
Thu, 17 Nov 2011 09:14:23 +0000 (10:14 +0100)
After assembling all devices, just wait for the raid devices to become
clean, before booting further.

modules.d/90mdraid/mdraid-waitclean.sh [new file with mode: 0755]
modules.d/90mdraid/module-setup.sh

diff --git a/modules.d/90mdraid/mdraid-waitclean.sh b/modules.d/90mdraid/mdraid-waitclean.sh
new file mode 100755 (executable)
index 0000000..c062fc7
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+containers=""
+for md in /dev/md[0-9_]*; do
+    [ -b "$md" ] || continue
+    udevinfo="$(udevadm info --query=env --name=$md)"
+    strstr "$udevinfo" "DEVTYPE=partition" && continue
+    if strstr "$udevinfo" "MD_LEVEL=container"; then
+        containers="$containers $md"
+        continue
+    fi
+    info "Waiting for $md to become clean"
+    mdadm -W "$md" >/dev/null 2>&1
+done
+
+for md in $containers; do
+    info "Waiting for $md to become clean"
+    mdadm -W "$md" >/dev/null 2>&1
+done
+
+unset containers udevinfo
index fe793bb34f1c2d6be1bd2d1da3862691e0e20226..029d667b12ac6df26b00d86ac8b9e6de5ab9dc87 100755 (executable)
@@ -83,6 +83,7 @@ install() {
     inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
     inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
     inst_hook pre-trigger 30 "$moddir/parse-md.sh"
+    inst_hook pre-mount 10 "$moddir/mdraid-waitclean.sh"
     inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
     inst_hook shutdown 30 "$moddir/md-shutdown.sh"
 }