mdraid: always create need_shutdown, if we have assembled a raid
authorHarald Hoyer <harald@redhat.com>
Tue, 14 Aug 2012 15:44:46 +0000 (17:44 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 14 Aug 2012 15:44:46 +0000 (17:44 +0200)
modules.d/90mdraid/mdraid-cleanup.sh
modules.d/90mdraid/mdraid-needshutdown.sh [new file with mode: 0755]
modules.d/90mdraid/module-setup.sh

index 9c4bc18..da86d65 100755 (executable)
@@ -14,11 +14,11 @@ for md in /dev/md[0-9_]*; do
         containers="$containers $md"
         continue
     fi
-    mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown
+    mdadm $_offroot -S "$md" >/dev/null 2>&1
 done
 
 for md in $containers; do
-    mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown
+    mdadm $_offroot -S "$md" >/dev/null 2>&1
 done
 
 unset containers udevinfo _offroot
diff --git a/modules.d/90mdraid/mdraid-needshutdown.sh b/modules.d/90mdraid/mdraid-needshutdown.sh
new file mode 100755 (executable)
index 0000000..79f9852
--- /dev/null
@@ -0,0 +1,11 @@
+#!/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
+
+for md in /dev/md[0-9_]*; do
+    [ -b "$md" ] || continue
+    need_shutdown
+    break
+done
index 8522756..6119226 100755 (executable)
@@ -84,6 +84,7 @@ install() {
     inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
     inst_hook pre-trigger 30 "$moddir/parse-md.sh"
     inst_hook pre-mount 10 "$moddir/mdraid-waitclean.sh"
+    inst_hook cleanup 99 "$moddir/mdraid-needshutdown.sh"
     inst_hook shutdown 30 "$moddir/md-shutdown.sh"
     inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
     inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start