summaryrefslogtreecommitdiffstats
path: root/shutdown
diff options
context:
space:
mode:
Diffstat (limited to 'shutdown')
-rw-r--r--shutdown8
1 files changed, 8 insertions, 0 deletions
diff --git a/shutdown b/shutdown
index a9ac8c6..483f5b1 100644
--- a/shutdown
+++ b/shutdown
@@ -29,6 +29,14 @@ stop_device() {
}
;;
raid*)
+ # wait for arrays with external metadata to be marked as
+ # clean. unfortunately, there isn't a whole lot we can do
+ # if this fails, and the array may need a full rebuild on
+ # the next reboot.
+ IFS=: read metadata _ < "/sys/class/block/$1/md/metadata_version"
+ if [ "$metdata" = external ]; then
+ mdadm --wait-clean "/dev/$1"
+ fi
mdadm --stop "/dev/$1"
;;
dmraid)