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