Blame 0009-mdraid_start.sh-fixed-raid-activation.patch

Harald Hoyer 3fb223
From 587b3497c149780f8c4e680d19a880418c5cc8bb Mon Sep 17 00:00:00 2001
Harald Hoyer 3fb223
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 3fb223
Date: Mon, 7 Sep 2009 14:11:18 +0200
Harald Hoyer 3fb223
Subject: [PATCH 09/12] mdraid_start.sh: fixed raid activation
Harald Hoyer 3fb223
Harald Hoyer 3fb223
---
Harald Hoyer 3fb223
 modules.d/90mdraid/65-md-incremental-imsm.rules |    6 ++++++
Harald Hoyer 3fb223
 modules.d/90mdraid/install                      |    3 ++-
Harald Hoyer 3fb223
 modules.d/90mdraid/mdcontainer_start.sh         |    9 +++++++++
Harald Hoyer 3fb223
 modules.d/90mdraid/mdraid_start.sh              |   18 ++----------------
Harald Hoyer 3fb223
 modules.d/95debug/install                       |    2 +-
Harald Hoyer 3fb223
 5 files changed, 20 insertions(+), 18 deletions(-)
Harald Hoyer 3fb223
 create mode 100755 modules.d/90mdraid/mdcontainer_start.sh
Harald Hoyer 3fb223
Harald Hoyer 3fb223
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
Harald Hoyer 3fb223
index 8385fb4..5104fc5 100644
Harald Hoyer 3fb223
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
Harald Hoyer 3fb223
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
Harald Hoyer 3fb223
@@ -23,3 +23,9 @@ RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}"
Harald Hoyer 3fb223
 RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k; /bin/ln -s /sbin/mdraid_start /initqueue/mdraid_start.sh'"
Harald Hoyer 3fb223
 
Harald Hoyer 3fb223
 LABEL="md_inc_end"
Harald Hoyer 3fb223
+
Harald Hoyer 3fb223
+ACTION=="add|change", \
Harald Hoyer 3fb223
+	ENV{DEVTYPE}!="partition", \
Harald Hoyer 3fb223
+	ENV{MD_LEVEL}=="container", \
Harald Hoyer 3fb223
+	TEST!="/tmp/.mdcontainer_start-%k", \
Harald Hoyer 3fb223
+	RUN+="/bin/sh -c '>/tmp/.mdcontainer_start-%k; initqueue /sbin/mdcontainer_start $env{DEVNAME}'"
Harald Hoyer 3fb223
diff --git a/modules.d/90mdraid/install b/modules.d/90mdraid/install
Harald Hoyer 3fb223
index 71c313b..c2de3bb 100755
Harald Hoyer 3fb223
--- a/modules.d/90mdraid/install
Harald Hoyer 3fb223
+++ b/modules.d/90mdraid/install
Harald Hoyer 3fb223
@@ -1,6 +1,6 @@
Harald Hoyer 3fb223
 #!/bin/bash
Harald Hoyer 3fb223
 
Harald Hoyer 3fb223
-dracut_install mdadm partx grep
Harald Hoyer 3fb223
+dracut_install mdadm partx 
Harald Hoyer 3fb223
 
Harald Hoyer 3fb223
 
Harald Hoyer 3fb223
 # XXX: mdmon really needs to run as non-root?
Harald Hoyer 3fb223
@@ -32,6 +32,7 @@ if [ -x  /sbin/mdmon ] ; then
Harald Hoyer 3fb223
 fi 
Harald Hoyer 3fb223
 
Harald Hoyer 3fb223
 inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
Harald Hoyer 3fb223
+inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start
Harald Hoyer 3fb223
 inst_hook pre-trigger 30 "$moddir/parse-md.sh"
Harald Hoyer 3fb223
 inst_hook pre-pivot 30 "$moddir/mdraid-cleanup.sh"
Harald Hoyer 3fb223
 inst_hook pre-pivot 31 "$moddir/mdraid-cleanup.sh"
Harald Hoyer 3fb223
diff --git a/modules.d/90mdraid/mdcontainer_start.sh b/modules.d/90mdraid/mdcontainer_start.sh
Harald Hoyer 3fb223
new file mode 100755
Harald Hoyer 3fb223
index 0000000..403b62b
Harald Hoyer 3fb223
--- /dev/null
Harald Hoyer 3fb223
+++ b/modules.d/90mdraid/mdcontainer_start.sh
Harald Hoyer 3fb223
@@ -0,0 +1,9 @@
Harald Hoyer 3fb223
+#!/bin/sh
Harald Hoyer 3fb223
+. /lib/dracut-lib.sh
Harald Hoyer 3fb223
+
Harald Hoyer 3fb223
+if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
Harald Hoyer 3fb223
+    # run mdadm if udev has settled
Harald Hoyer 3fb223
+    md=$1
Harald Hoyer 3fb223
+    # and activate any containers
Harald Hoyer 3fb223
+    mdadm -IR $md 2>&1 | vinfo
Harald Hoyer 3fb223
+fi
Harald Hoyer 3fb223
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
Harald Hoyer 3fb223
index a6868bd..55e7d9c 100755
Harald Hoyer 3fb223
--- a/modules.d/90mdraid/mdraid_start.sh
Harald Hoyer 3fb223
+++ b/modules.d/90mdraid/mdraid_start.sh
Harald Hoyer 3fb223
@@ -4,20 +4,6 @@ if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
Harald Hoyer 3fb223
     [ -h "$job" ] && rm -f "$job"
Harald Hoyer 3fb223
     # run mdadm if udev has settled
Harald Hoyer 3fb223
     info "Assembling MD RAID arrays"
Harald Hoyer 3fb223
-
Harald Hoyer 3fb223
-    # and activate any containers
Harald Hoyer 3fb223
-    for md in /dev/md?*; do
Harald Hoyer 3fb223
-        case $md in
Harald Hoyer 3fb223
-	    /dev/md*p*) ;;
Harald Hoyer 3fb223
-	    *)
Harald Hoyer 3fb223
-                if mdadm --query --test --detail $md 2>&1|grep -q 'does not appear to be active'; then
Harald Hoyer 3fb223
-		    info "Starting MD RAID array $md"
Harald Hoyer 3fb223
-                    mdadm -R $md 2>&1 | vinfo
Harald Hoyer 3fb223
-                    if mdadm --query --test --detail $md 2>&1|grep -q 'does not appear to be active'; then
Harald Hoyer 3fb223
-                        mdadm -IR $md 2>&1 | vinfo
Harald Hoyer 3fb223
-                    fi
Harald Hoyer 3fb223
-                    udevsettle
Harald Hoyer 3fb223
-               fi
Harald Hoyer 3fb223
-        esac
Harald Hoyer 3fb223
-    done
Harald Hoyer 3fb223
+    mdadm -IRs 2>&1 | vinfo
Harald Hoyer 3fb223
+    udevsettle 
Harald Hoyer 3fb223
 fi
Harald Hoyer 3fb223
diff --git a/modules.d/95debug/install b/modules.d/95debug/install
Harald Hoyer 3fb223
index 1597187..1c7afaf 100755
Harald Hoyer 3fb223
--- a/modules.d/95debug/install
Harald Hoyer 3fb223
+++ b/modules.d/95debug/install
Harald Hoyer 3fb223
@@ -1,3 +1,3 @@
Harald Hoyer 3fb223
 #!/bin/bash
Harald Hoyer 3fb223
 dracut_install -o ps grep more cat rm strace free showmount 
Harald Hoyer 3fb223
-dracut_install -o ping netstat rpcinfo
Harald Hoyer 3fb223
+dracut_install -o ping netstat rpcinfo vi
Harald Hoyer 3fb223
-- 
Harald Hoyer 3fb223
1.6.2.5
Harald Hoyer 3fb223