|
Harald Hoyer |
55891e |
From a025cc17f0d8145492ffbb37735deca208e768bd 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:28 +0200
|
|
Harald Hoyer |
55891e |
Subject: [PATCH] 90mdraid: fix/adjust 65-md* rules and related scripts
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
Reworked the flow of the rules file a bit, removed redundant tests, also
|
|
Harald Hoyer |
55891e |
should be easier to follow. It's much shorter now as well, a bit more
|
|
Harald Hoyer |
55891e |
similar to 90lvm script - both revolve around same concepts after all.
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
There's no reason to treat conf-assembled arrays differently from
|
|
Harald Hoyer |
55891e |
incremental ones. Once we hit timeout in init's udev loop, we can use
|
|
Harald Hoyer |
55891e |
common script (mdraid_start.sh) to try force inactive arrays
|
|
Harald Hoyer |
55891e |
into degraded mode.
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
md-finished.sh was kind-of out of place - it didn't really wait for any
|
|
Harald Hoyer |
55891e |
particular device(s) to show up, just watched if onetime mdadm scripts
|
|
Harald Hoyer |
55891e |
are still in place. Furthermore, after moving mdraid_start to --timeout
|
|
Harald Hoyer |
55891e |
initqueue, it didn't really have too much to watch at all, besides
|
|
Harald Hoyer |
55891e |
mdadm_auto (and that served no purpose, as we do wait for concrete
|
|
Harald Hoyer |
55891e |
devices).
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
Either way, with stock 64-md fixes, current version of 65-md*.rules does
|
|
Harald Hoyer |
55891e |
the following:
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
- limits assembly to certain uuids, if specified
|
|
Harald Hoyer |
55891e |
- watch for no ddf/imsm
|
|
Harald Hoyer |
55891e |
- if mdadm.conf => setup onetime -As script, without forced --run option
|
|
Harald Hoyer |
55891e |
- if !mdadm.conf => incrementally assemble
|
|
Harald Hoyer |
55891e |
- for both cases, setup timeout script, run-forcing arrays as a last resort
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
Signed-off-by: Michal Soltys <soltys@ziu.info>
|
|
Harald Hoyer |
55891e |
---
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/65-md-incremental-imsm.rules | 79 ++++++++---------------
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/md_finished.sh | 9 ---
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/mdadm_auto.sh | 2 +-
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/module-setup.sh | 1 -
|
|
Harald Hoyer |
55891e |
modules.d/90mdraid/parse-md.sh | 8 ++-
|
|
Harald Hoyer |
55891e |
5 files changed, 34 insertions(+), 65 deletions(-)
|
|
Harald Hoyer |
55891e |
delete mode 100755 modules.d/90mdraid/md_finished.sh
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
|
|
Harald Hoyer |
55891e |
index bb030cf..209b17b 100644
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
|
|
Harald Hoyer |
55891e |
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
|
|
Harald Hoyer |
55891e |
@@ -2,68 +2,45 @@
|
|
Harald Hoyer |
55891e |
# automatically cause mdadm to be run.
|
|
Harald Hoyer |
55891e |
# See udev(8) for syntax
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-ACTION!="add|change", GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-SUBSYSTEM!="block", GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-ENV{ID_FS_TYPE}!="*_raid_member", GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-ENV{rd_NO_MD}=="?*", GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
|
|
Harald Hoyer |
55891e |
- GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
+ACTION!="add|change", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+SUBSYSTEM!="block", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+ENV{rd_NO_MD}=="?*", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+KERNEL=="md*", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+
|
|
Harald Hoyer |
55891e |
+ENV{ID_FS_TYPE}!="*_raid_member", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+
|
|
Harald Hoyer |
55891e |
+# already done ?
|
|
Harald Hoyer |
55891e |
+PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
|
|
Harald Hoyer |
55891e |
+ GOTO="md_end"
|
|
Harald Hoyer |
55891e |
+
|
|
Harald Hoyer |
55891e |
+# for native arrays - array's uuid has to be specified
|
|
Harald Hoyer |
55891e |
+# for containers - container's uuid has to be specified
|
|
Harald Hoyer |
55891e |
+# TODO : how to get embedded array's uuid having container's component ?
|
|
Harald Hoyer |
55891e |
+#
|
|
Harald Hoyer |
55891e |
+# UUID CHECK
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
ENV{DEVTYPE}!="partition", \
|
|
Harald Hoyer |
55891e |
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-# UUID CHECK
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-LABEL="do_md_inc"
|
|
Harald Hoyer |
55891e |
+RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
+# if rd_MDADMCONF is set, do not assemble incrementally;
|
|
Harald Hoyer |
55891e |
+# defer conf-based assembly until the udev queue is settled
|
|
Harald Hoyer |
55891e |
#
|
|
Harald Hoyer |
55891e |
-# if rd_MDADMCONF do not assemble incrementally
|
|
Harald Hoyer |
55891e |
-# defer auto assembly until the udev queue is settled
|
|
Harald Hoyer |
55891e |
-#
|
|
Harald Hoyer |
55891e |
-ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
|
|
Harald Hoyer |
55891e |
+ENV{rd_MDADMCONF}!="?*", GOTO="md_incremental"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
|
Harald Hoyer |
55891e |
RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-GOTO="md_inc_end"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-LABEL="md_auto_end"
|
|
Harald Hoyer |
55891e |
+GOTO="md_end"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
#
|
|
Harald Hoyer |
55891e |
-# Incrementally build the md array
|
|
Harald Hoyer |
55891e |
+# Incrementally build the md array; this will automatically assemble
|
|
Harald Hoyer |
55891e |
+# any eventual containers as well (imsm, ddf)
|
|
Harald Hoyer |
55891e |
#
|
|
Harald Hoyer |
55891e |
-RUN+="/sbin/mdadm -I $env{DEVNAME}"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-LABEL="md_inc_end"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-#
|
|
Harald Hoyer |
55891e |
-# Handle non-container raid arrays
|
|
Harald Hoyer |
55891e |
-#
|
|
Harald Hoyer |
55891e |
-ACTION=="add|change", \
|
|
Harald Hoyer |
55891e |
- KERNEL=="md[0-9]*|md/*", \
|
|
Harald Hoyer |
55891e |
- ENV{MD_LEVEL}!="container", \
|
|
Harald Hoyer |
55891e |
- ENV{MD_CONTAINER}!="?*", \
|
|
Harald Hoyer |
55891e |
- ENV{rd_MDADMCONF}!="?*", \
|
|
Harald Hoyer |
55891e |
- ENV{rd_NO_MD}!="?*", \
|
|
Harald Hoyer |
55891e |
- GOTO="do_raidstart"
|
|
Harald Hoyer |
55891e |
+LABEL="md_incremental"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-GOTO="end_raidstart"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-LABEL="do_raidstart"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-# check if array is not inactive anymore
|
|
Harald Hoyer |
55891e |
-TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
|
Harald Hoyer |
55891e |
-RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
|
|
Harald Hoyer |
55891e |
+RUN+="/sbin/mdadm -I $env{DEVNAME}"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
-LABEL="end_raidstart"
|
|
Harald Hoyer |
55891e |
+LABEL="md_end"
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/md_finished.sh b/modules.d/90mdraid/md_finished.sh
|
|
Harald Hoyer |
55891e |
deleted file mode 100755
|
|
Harald Hoyer |
55891e |
index ce355be..0000000
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/md_finished.sh
|
|
Harald Hoyer |
55891e |
+++ /dev/null
|
|
Harald Hoyer |
55891e |
@@ -1,9 +0,0 @@
|
|
Harald Hoyer |
55891e |
-#!/bin/sh
|
|
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 |
-for f in $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
|
|
Harald Hoyer |
55891e |
- [ -e $f ] && exit 1
|
|
Harald Hoyer |
55891e |
-done
|
|
Harald Hoyer |
55891e |
-
|
|
Harald Hoyer |
55891e |
-$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || exit 1
|
|
Harald Hoyer |
55891e |
-exit 0
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/mdadm_auto.sh b/modules.d/90mdraid/mdadm_auto.sh
|
|
Harald Hoyer |
55891e |
index 915fb28..9b61bf5 100755
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/mdadm_auto.sh
|
|
Harald Hoyer |
55891e |
+++ b/modules.d/90mdraid/mdadm_auto.sh
|
|
Harald Hoyer |
55891e |
@@ -4,4 +4,4 @@
|
|
Harald Hoyer |
55891e |
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
info "Autoassembling MD Raid"
|
|
Harald Hoyer |
55891e |
-mdadm -As --auto=yes --run 2>&1 | vinfo
|
|
Harald Hoyer |
55891e |
+mdadm -As --auto=yes 2>&1 | vinfo
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
|
|
Harald Hoyer |
55891e |
index 5c526a0..12e6739 100755
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/module-setup.sh
|
|
Harald Hoyer |
55891e |
+++ b/modules.d/90mdraid/module-setup.sh
|
|
Harald Hoyer |
55891e |
@@ -82,7 +82,6 @@ install() {
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
|
Harald Hoyer |
55891e |
inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
|
|
Harald Hoyer |
55891e |
- inst "$moddir/md_finished.sh" /sbin/md_finished.sh
|
|
Harald Hoyer |
55891e |
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
|
|
Harald Hoyer |
55891e |
inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
|
Harald Hoyer |
55891e |
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
|
|
Harald Hoyer |
55891e |
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
|
|
Harald Hoyer |
55891e |
index 33d93dc..b85a3a3 100755
|
|
Harald Hoyer |
55891e |
--- a/modules.d/90mdraid/parse-md.sh
|
|
Harald Hoyer |
55891e |
+++ b/modules.d/90mdraid/parse-md.sh
|
|
Harald Hoyer |
55891e |
@@ -13,12 +13,14 @@ else
|
|
Harald Hoyer |
55891e |
[ -e "$f" ] || continue
|
|
Harald Hoyer |
55891e |
while read line; do
|
|
Harald Hoyer |
55891e |
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
|
Harald Hoyer |
55891e |
+ printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
|
|
Harald Hoyer |
55891e |
for uuid in $MD_UUID; do
|
|
Harald Hoyer |
55891e |
- printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
|
|
Harald Hoyer |
55891e |
+ printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
|
|
Harald Hoyer |
55891e |
done;
|
|
Harald Hoyer |
55891e |
- printf 'GOTO="md_inc_end"\n';
|
|
Harald Hoyer |
55891e |
+ printf 'GOTO="md_end"\n'
|
|
Harald Hoyer |
55891e |
+ printf 'LABEL="md_uuid_ok"\n'
|
|
Harald Hoyer |
55891e |
else
|
|
Harald Hoyer |
55891e |
- echo $line;
|
|
Harald Hoyer |
55891e |
+ echo "$line"
|
|
Harald Hoyer |
55891e |
fi
|
|
Harald Hoyer |
55891e |
done < "${f}" > "${f}.new"
|
|
Harald Hoyer |
55891e |
mv "${f}.new" "$f"
|