|
Harald Hoyer |
55891e |
From 9383421c1cfc5fe1bc94cf3d3194bd96ee503628 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
55891e |
From: Michal Soltys <soltys@ziu.info>
|
|
Harald Hoyer |
55891e |
Date: Tue, 6 Sep 2011 00:17:26 +0200
|
|
Harald Hoyer |
55891e |
Subject: [PATCH] 90mdraid: fix/adjust mdraid-cleanup
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
Stop both arrays (first pass) and containers (second pass).
|
|
Harald Hoyer |
55891e |
Loop only over /dev/md[0-9]*
|
|
Harald Hoyer |
55891e |
Call cleanup script only once, make sure it's after crypt cleanup.
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
Signed-off-by: Michal Soltys <soltys@ziu.info>
|
|
Harald Hoyer |
55891e |
---
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/mdraid-cleanup.sh | 30 +++++++++++++++++-------------
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/mdraid_start.sh | 1 -
|
|
Harald Hoyer |
55891e |
2 files changed, 17 insertions(+), 14 deletions(-)
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
|
|
Harald Hoyer |
55891e |
index add02e0..8fc54e2 100755
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/mdraid-cleanup.sh
|
|
Harald Hoyer |
55891e |
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
|
|
Harald Hoyer |
55891e |
@@ -2,18 +2,22 @@
|
|
Harald Hoyer |
55891e |
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
55891e |
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-# stop everything which is not busy
|
|
Harald Hoyer |
55891e |
-for i in /dev/md* /dev/md/*; do
|
|
Harald Hoyer |
55891e |
- [ -b $i ] || continue
|
|
Harald Hoyer |
55891e |
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
- mddetail=$(udevadm info --query=property --name=$i)
|
|
Harald Hoyer |
55891e |
- case "$mddetail" in
|
|
Harald Hoyer |
55891e |
- *MD_LEVEL=container*)
|
|
Harald Hoyer |
55891e |
- ;;
|
|
Harald Hoyer |
55891e |
- *DEVTYPE=partition*)
|
|
Harald Hoyer |
55891e |
- ;;
|
|
Harald Hoyer |
55891e |
- *)
|
|
Harald Hoyer |
55891e |
- mdadm --stop $i >/dev/null 2>&1
|
|
Harald Hoyer |
55891e |
- ;;
|
|
Harald Hoyer |
55891e |
- esac
|
|
Harald Hoyer |
55891e |
+containers=""
|
|
Harald Hoyer |
55891e |
+for md in /dev/md[0-9]*; do
|
|
Harald Hoyer |
55891e |
+ [ -b "$md" ] || continue
|
|
Harald Hoyer |
55891e |
+ udevinfo="$(udevadm info --query=env --name=$md)"
|
|
Harald Hoyer |
55891e |
+ strstr "$udevinfo" "DEVTYPE=partition" && continue
|
|
Harald Hoyer |
55891e |
+ if strstr "$udevinfo" "MD_LEVEL=container"; then
|
|
Harald Hoyer |
55891e |
+ containers="$containers $md"
|
|
Harald Hoyer |
55891e |
+ continue
|
|
Harald Hoyer |
55891e |
+ fi
|
|
Harald Hoyer |
55891e |
+ mdadm -S "$md" >/dev/null 2>&1
|
|
Harald Hoyer |
55891e |
done
|
|
Harald Hoyer |
55891e |
+
|
|
Harald Hoyer |
55891e |
+for md in $containers; do
|
|
Harald Hoyer |
55891e |
+ mdadm -S "$md" >/dev/null 2>&1
|
|
Harald Hoyer |
55891e |
+done
|
|
Harald Hoyer |
55891e |
+
|
|
Harald Hoyer |
55891e |
+unset containers udevinfo
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
|
|
Harald Hoyer |
55891e |
index 4aa7f82..4c0255e 100755
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/mdraid_start.sh
|
|
Harald Hoyer |
55891e |
+++ b/modules.d/90mdraid/mdraid_start.sh
|
|
Harald Hoyer |
55891e |
@@ -21,6 +21,5 @@ for md in /dev/md[0-9]* /dev/md/*; do
|
|
Harald Hoyer |
55891e |
done
|
|
Harald Hoyer |
55891e |
unset udevinfo
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
|
Harald Hoyer |
55891e |
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
|
Harald Hoyer |
55891e |
udevadm control --start-exec-queue
|