Blob Blame History Raw
From 57038a41fac7db2ae90a6cbc10cf9b737768a115 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 8 Jun 2012 10:28:31 +0200
Subject: [PATCH] mdraid/md-shutdown.sh: wait until md devices are clean

---
 modules.d/90mdraid/md-shutdown.sh |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh
index 0d41008..1e6c9f6 100755
--- a/modules.d/90mdraid/md-shutdown.sh
+++ b/modules.d/90mdraid/md-shutdown.sh
@@ -5,12 +5,15 @@ _do_md_shutdown() {
     local ret
     local final=$1
     local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
-    info "Disassembling mdraid devices."
-    mdadm $_offroot -v --stop --scan
+    info "Waiting for mdraid devices to be clean."
+    mdadm $_offroot -vv --wait-clean --scan| vinfo
     ret=$?
+    info "Disassembling mdraid devices."
+    mdadm $_offroot -vv --stop --scan | vinfo
+    ret=$(($ret+$?))
     if [ "x$final" != "x" ]; then
-        info "cat /proc/mdstat"
-        cat /proc/mdstat | vinfo
+        info "/proc/mdstat:"
+        vinfo < /proc/mdstat
     fi
     return $ret
 }