summaryrefslogtreecommitdiffstats
path: root/shutdown
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-11-05 22:12:41 +0100
committerDave Reisner <dreisner@archlinux.org>2012-11-11 00:47:33 +0100
commitb73a18a30b2d1fcb9b9107dab98e8d2881eca4ef (patch)
treecfb1d961c91ea622b624350a483dbb17ae1f7cc4 /shutdown
parentd74d06d7936350df02a4233caf972b071eb74efc (diff)
downloadmkinitcpio-b73a18a30b2d1fcb9b9107dab98e8d2881eca4ef.tar.gz
mkinitcpio-b73a18a30b2d1fcb9b9107dab98e8d2881eca4ef.tar.xz
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 <dreisner@archlinux.org>
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)