From: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: neilb-l3A5Bk7waGM@public.gmane.org,
jacek.danecki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: [RFC PATCH 2/3] raid: external and internal metadata support
Date: Thu, 05 Feb 2009 15:49:20 -0700 [thread overview]
Message-ID: <20090205224920.18610.63979.stgit@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <20090205224808.18610.14957.stgit-p8uTFz9XbKjBPTuBivz2/GFmcEqAMTzPQQ4Iyu8u01E@public.gmane.org>
External metadata support implies that metadata events are handled by a
userspace daemon. This daemon, mdmon, needs to be started ahead of the
rootfs being mounted to handle the raid volume dirty bit. Even if the
rootfs is mounted read-only the rootdev may still be written by
filesystem journal-playback operations.
After the rootfs is mounted to /sysroot, mdmon is restarted in the new
namespace. The command "mdmon /proc/mdstat /sysroot" tells mdmon to
terminate any instances in the current namespace and then launch new
instances, chroot(2) to /sysroot, per container device found in
/proc/mdstat.
Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
dracut | 11 +++++++++--
init | 10 ++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dracut b/dracut
index ef2ca42..513b6c6 100755
--- a/dracut
+++ b/dracut
@@ -69,13 +69,14 @@ initdir=$(mktemp -d -t initramfs.XXXXXX)
exe="/bin/bash /bin/mount /bin/mknod /bin/mkdir /sbin/modprobe /sbin/udevd /sbin/udevadm /sbin/nash /bin/kill /sbin/pidof /bin/sleep /bin/echo /usr/sbin/chroot"
lvmexe="/sbin/lvm"
cryptexe="/sbin/cryptsetup"
+raidexe="/sbin/mdadm /sbin/mdmon"
# and some things that are nice for debugging
debugexe="/bin/ls /bin/cat /bin/ln /bin/ps /bin/grep /bin/more"
# udev things we care about
udevexe="/lib/udev/vol_id /lib/udev/console_init"
# install base files
-for binary in $exe $debugexe $udevexe $lvmexe $cryptexe ; do
+for binary in $exe $debugexe $udevexe $lvmexe $cryptexe $raidexe ; do
inst $binary $initdir
done
@@ -152,7 +153,7 @@ cp $switchroot $initdir/sbin/switch_root
mkdir -p $initdir/etc $initdir/proc $initdir/sys $initdir/sysroot $initdir/dev/pts
# FIXME: hard-coded module list of doom.
-[ -z "$modules" ] && modules="=ata =block =drm dm-crypt aes sha256 cbc"
+[ -z "$modules" ] && modules="=ata =block =drm =raid dm-crypt aes sha256 cbc"
mkdir -p $initdir/lib/modules/$kernel
# expand out module deps, etc
@@ -171,6 +172,12 @@ if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
/usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir" || :
fi
+# raid
+# mdadm.conf allows mdadm to disambiguate foreign arrays for some metadata types
+# check /etc and /etc/mdadm (/etc wins if both are present)
+[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf "$initdir" /etc/mdadm.conf
+[ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf "$initdir"
+
pushd $initdir >/dev/null
find . |cpio -H newc -o |gzip -9 > $outfile
popd >/dev/null
diff --git a/init b/init
index 706127f..0294502 100755
--- a/init
+++ b/init
@@ -46,6 +46,13 @@ mknod /dev/tty1 c 4 1
/sbin/udevd --daemon
/sbin/udevadm trigger
+# start any defined raid arrays
+# we settle before assembling to hopefully prevent prematurely degrading arrays
+if [ -f /etc/mdadm.conf ]; then
+ /sbin/udevadm settle
+ /sbin/mdadm -Asc /etc/mdadm.conf
+fi
+
# mount the rootfs
NEWROOT="/sysroot"
@@ -110,6 +117,9 @@ kill `pidof udevd`
[ -x /bin/plymouth ] && /bin/plymouth --newroot=$NEWROOT
+# switch any mdmon instances to newroot
+[ -f /etc/mdadm.conf ] && /sbin/mdmon /proc/mdstat $NEWROOT
+
# FIXME: nash die die die
exec /sbin/switch_root
# davej doesn't like initrd bugs
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-02-05 22:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 22:49 [RFC PATCH 0/3] mdraid rootfs support Dan Williams
[not found] ` <20090205224808.18610.14957.stgit-p8uTFz9XbKjBPTuBivz2/GFmcEqAMTzPQQ4Iyu8u01E@public.gmane.org>
2009-02-05 22:49 ` [RFC PATCH 1/3] gen-mod-lists: create lists of modules that may talk to a root device Dan Williams
2009-02-05 22:49 ` Dan Williams [this message]
[not found] ` <20090205224920.18610.63979.stgit-p8uTFz9XbKjBPTuBivz2/GFmcEqAMTzPQQ4Iyu8u01E@public.gmane.org>
2009-02-06 16:40 ` [RFC PATCH 2/3] raid: external and internal metadata support Jeremy Katz
[not found] ` <20090206164019.GD552-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-02-06 16:50 ` Danecki, Jacek
[not found] ` <A9DE54D0CD747C4CB06DCE5B6FA2246F4B496AFA-IGOiFh9zz4yvNW/NfzhIbrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2009-02-06 16:55 ` Dan Williams
2009-02-06 16:56 ` Bill Nottingham
[not found] ` <20090206165601.GF11144-Zdt1ptygihhQcNjhGXsBABcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2009-02-06 17:27 ` Dan Williams
[not found] ` <e9c3a7c20902060927j2b900940kd851573469110135-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-06 17:38 ` Bill Nottingham
[not found] ` <20090206173814.GA3541-Zdt1ptygihhQcNjhGXsBABcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2009-02-06 18:00 ` Jacek Danecki
[not found] ` <498C7AD8.6080105-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2009-02-06 19:34 ` NeilBrown
[not found] ` <2c0cae741a7229789cd777d93180072a.squirrel-eq65iwfR9nKIECXXMXunQA@public.gmane.org>
2009-02-06 20:03 ` Bill Nottingham
2009-02-08 19:08 ` Szabolcs Szakacsits
2009-02-06 18:12 ` Dan Williams
[not found] ` <e9c3a7c20902061012w15a31e7br6ce2074b7b9db555-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-06 18:21 ` Bill Nottingham
[not found] ` <20090206182118.GA4413-Zdt1ptygihhQcNjhGXsBABcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2009-02-06 19:19 ` Dan Williams
[not found] ` <e9c3a7c20902061119i2120cc5fpda0a5cdc3aedc17b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-06 20:08 ` Bill Nottingham
[not found] ` <20090206200818.GC6150-Zdt1ptygihhQcNjhGXsBABcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2009-02-06 20:21 ` NeilBrown
[not found] ` <8c48d75b834c74adc39b6e904a44237e.squirrel-eq65iwfR9nKIECXXMXunQA@public.gmane.org>
2009-02-06 20:27 ` Bill Nottingham
2009-02-06 20:26 ` Dan Williams
[not found] ` <e9c3a7c20902061226m3f1e9e55pc2986a8527ade77-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-09 20:19 ` Warren Togami
2009-02-08 19:16 ` Szabolcs Szakacsits
2009-02-06 18:02 ` Dan Williams
2009-02-05 22:49 ` [RFC PATCH 3/3] add more disk id helpers to udevexe Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090205224920.18610.63979.stgit@dwillia2-linux.ch.intel.com \
--to=dan.j.williams-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jacek.danecki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=neilb-l3A5Bk7waGM@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox