From b73a18a30b2d1fcb9b9107dab98e8d2881eca4ef Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 5 Nov 2012 16:12:41 -0500 Subject: shutdown: pamper RAID devices with external metadata Ensure that these devices (likely FakeRAID) are clean before stopping, to avoid leaving them in the dirty state and forcing a rebuild. Signed-off-by: Dave Reisner --- shutdown | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- cgit v1.2.3-24-g4f1b