Multiple fixes for mdadm:

- upstream bugfixes in 3.3
 - simplify array assembly in initrd and normal boot.

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=93
This commit is contained in:
Neil Brown 2013-09-13 01:49:53 +00:00 committed by Git OBS Bridge
parent 4af8f82cac
commit a8a26f3695
9 changed files with 447 additions and 162 deletions

View File

@ -0,0 +1,52 @@
From b95cb4b9d88c8adf2adb7f2efef3ae3f72b27b8e Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 12 Sep 2013 14:57:28 +1000
Subject: [PATCH] DDF: allow for possibility that there is no secondary copy of
metadata.
If there isn't, we currently write the second copy at some
random location :-)
Reported-and-tested-by: Francis Moreau <francis.moro@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-ddf.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/super-ddf.c b/super-ddf.c
index 636d7b4..d2cdda4 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -880,7 +880,8 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname)
super->primary.openflag && !super->secondary.openflag)
)
super->active = &super->secondary;
- } else if (devname)
+ } else if (devname &&
+ be64_to_cpu(super->anchor.secondary_lba) != ~(__u64)0)
pr_err("Failed to load secondary DDF header on %s\n",
devname);
if (super->active == NULL)
@@ -2810,7 +2811,9 @@ static int add_to_super_ddf(struct supertype *st,
} while (0)
__calc_lba(dd, ddf->dlist, workspace_lba, 32);
__calc_lba(dd, ddf->dlist, primary_lba, 16);
- __calc_lba(dd, ddf->dlist, secondary_lba, 32);
+ if (ddf->dlist == NULL ||
+ be64_to_cpu(ddf->dlist->secondary_lba) != ~(__u64)0)
+ __calc_lba(dd, ddf->dlist, secondary_lba, 32);
pde->config_size = dd->workspace_lba;
sprintf(pde->path, "%17.17s","Information: nil") ;
@@ -2892,6 +2895,8 @@ static int __write_ddf_structure(struct dl *d, struct ddf_super *ddf, __u8 type)
default:
return 0;
}
+ if (sector == ~(__u64)0)
+ return 0;
header->type = type;
header->openflag = 1;
--
1.8.3.1.487.g3e7a5b4

View File

@ -0,0 +1,252 @@
From d5a4041647d2b3328ce45ff727afe37477f07c75 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 13 Sep 2013 10:51:20 +1000
Subject: [PATCH] Make -IRs and --run work properly for containers.
We really need to make sure assemble_container_content()
gets called to finished the assembly of these.
Reported-by: Francis Moreau <francis.moro@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
Assemble.c | 2 +-
Incremental.c | 53 +++++++++++++++++++++++++++++++++++++++++++++--------
Manage.c | 4 ++--
mdadm.c | 7 ++++---
mdadm.h | 4 ++--
5 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index bc85603..86b4c89 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1817,7 +1817,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
working++;
} else if (errno == EEXIST)
preexist++;
- if (working + expansion == 0)
+ if (working + expansion == 0 && c->runstop <= 0)
return 1;/* Nothing new, don't try to start */
map_update(&map, fd2devnm(mdfd),
diff --git a/Incremental.c b/Incremental.c
index f256b48..1bb3638 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -44,7 +44,7 @@ static int try_spare(char *devname, int *dfdp, struct dev_policy *pol,
struct supertype *st, int verbose);
static int Incremental_container(struct supertype *st, char *devname,
- struct context *c);
+ struct context *c, char *only);
int Incremental(char *devname, struct context *c,
struct supertype *st)
@@ -138,7 +138,7 @@ int Incremental(char *devname, struct context *c,
if (map_lock(&map))
pr_err("failed to get "
"exclusive lock on mapfile\n");
- rv = Incremental_container(st, devname, c);
+ rv = Incremental_container(st, devname, c, NULL);
map_unlock(&map);
return rv;
}
@@ -478,7 +478,7 @@ int Incremental(char *devname, struct context *c,
close(mdfd);
sysfs_free(sra);
if (!rv)
- rv = Incremental_container(st, chosen_name, c);
+ rv = Incremental_container(st, chosen_name, c, NULL);
map_unlock(&map);
if (rv == 1)
/* Don't fail the whole -I if a subarray didn't
@@ -1278,7 +1278,7 @@ static int try_spare(char *devname, int *dfdp, struct dev_policy *pol,
return rv;
}
-int IncrementalScan(int verbose, char *devnm)
+int IncrementalScan(struct context *c, char *devnm)
{
/* look at every device listed in the 'map' file.
* If one is found that is not running then:
@@ -1290,10 +1290,13 @@ int IncrementalScan(int verbose, char *devnm)
struct map_ent *me;
struct mddev_ident *devs, *mddev;
int rv = 0;
+ char container[32];
+ char *only = NULL;
map_read(&mapl);
devs = conf_get_ident(NULL);
+restart:
for (me = mapl ; me ; me = me->next) {
mdu_array_info_t array;
mdu_bitmap_file_t bmf;
@@ -1302,10 +1305,42 @@ int IncrementalScan(int verbose, char *devnm)
if (devnm && strcmp(devnm, me->devnm) != 0)
continue;
+ if (devnm && me->metadata[0] == '/') {
+ char *sl;
+ /* member array, need to work on container */
+ strncpy(container, me->metadata+1, 32);
+ container[31] = 0;
+ sl = strchr(container, '/');
+ if (sl)
+ *sl = 0;
+ only = devnm;
+ devnm = container;
+ goto restart;
+ }
mdfd = open_dev(me->devnm);
if (mdfd < 0)
continue;
+ if (!isdigit(me->metadata[0])) {
+ /* must be a container */
+ struct supertype *st = super_by_fd(mdfd, NULL);
+ int ret = 0;
+ struct map_ent *map = NULL;
+ if (st)
+ st->ignore_hw_compat = 1;
+ if (st && st->ss->load_container)
+ ret = st->ss->load_container(st, mdfd, NULL);
+ close(mdfd);
+ if (!ret && st->ss->container_content) {
+ if (map_lock(&map))
+ pr_err("failed to get exclusive lock on mapfile\n");
+ ret = Incremental_container(st, me->path, c, only);
+ map_unlock(&map);
+ }
+ if (ret)
+ rv = 1;
+ continue;
+ }
if (ioctl(mdfd, GET_ARRAY_INFO, &array) == 0 ||
errno != ENODEV) {
close(mdfd);
@@ -1330,7 +1365,7 @@ int IncrementalScan(int verbose, char *devnm)
close(bmfd);
}
}
- if (verbose >= 0) {
+ if (c->verbose >= 0) {
if (added == 0)
pr_err("Added bitmap %s to %s\n",
mddev->bitmap_file, me->path);
@@ -1346,7 +1381,7 @@ int IncrementalScan(int verbose, char *devnm)
if (sra) {
if (sysfs_set_str(sra, NULL,
"array_state", "read-auto") == 0) {
- if (verbose >= 0)
+ if (c->verbose >= 0)
pr_err("started array %s\n",
me->path ?: me->devnm);
} else {
@@ -1387,7 +1422,7 @@ static char *container2devname(char *devname)
}
static int Incremental_container(struct supertype *st, char *devname,
- struct context *c)
+ struct context *c, char *only)
{
/* Collect the contents of this container and for each
* array, choose a device name and assemble the array.
@@ -1458,7 +1493,7 @@ static int Incremental_container(struct supertype *st, char *devname,
strcpy(chosen_name, mp->path);
else
strcpy(chosen_name, mp->devnm);
- } else {
+ } else if (!only) {
/* Check in mdadm.conf for container == devname and
* member == ra->text_version after second slash.
@@ -1515,6 +1550,8 @@ static int Incremental_container(struct supertype *st, char *devname,
trustworthy,
chosen_name);
}
+ if (only && (!mp || strcmp(mp->devnm, only) != 0))
+ continue;
if (mdfd < 0) {
pr_err("failed to open %s: %s.\n",
diff --git a/Manage.c b/Manage.c
index 910caa6..c8276ca 100644
--- a/Manage.c
+++ b/Manage.c
@@ -170,7 +170,7 @@ static void remove_devices(char *devnm, char *path)
free(path2);
}
-int Manage_run(char *devname, int fd, int verbose)
+int Manage_run(char *devname, int fd, struct context *c)
{
/* Run the array. Array must already be configured
* Requires >= 0.90.0
@@ -187,7 +187,7 @@ int Manage_run(char *devname, int fd, int verbose)
return 1;
}
strcpy(nm, nmp);
- return IncrementalScan(verbose, nm);
+ return IncrementalScan(c, nm);
}
int Manage_stop(char *devname, int fd, int verbose, int will_retry)
diff --git a/mdadm.c b/mdadm.c
index 1ada607..f55a035 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1293,7 +1293,7 @@ int main(int argc, char *argv[])
if (!rv && c.readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, c.readonly);
if (!rv && c.runstop > 0)
- rv = Manage_run(devlist->devname, mdfd, c.verbose);
+ rv = Manage_run(devlist->devname, mdfd, &c);
if (!rv && c.runstop < 0)
rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0);
break;
@@ -1535,7 +1535,7 @@ int main(int argc, char *argv[])
pr_err("--incremental --scan --fail not supported.\n");
break;
}
- rv = IncrementalScan(c.verbose, NULL);
+ rv = IncrementalScan(&c, NULL);
}
if (!devlist) {
if (!rebuild_map && !c.scan) {
@@ -1804,7 +1804,8 @@ static int misc_list(struct mddev_dev *devlist,
if (mdfd>=0) {
switch(dv->disposition) {
case 'R':
- rv |= Manage_run(dv->devname, mdfd, c->verbose); break;
+ c->runstop = 1;
+ rv |= Manage_run(dv->devname, mdfd, c); break;
case 'S':
rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0); break;
case 'o':
diff --git a/mdadm.h b/mdadm.h
index 2eca603..c90fe10 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1171,7 +1171,7 @@ struct stat64;
extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
extern int Manage_ro(char *devname, int fd, int readonly);
-extern int Manage_run(char *devname, int fd, int quiet);
+extern int Manage_run(char *devname, int fd, struct context *c);
extern int Manage_stop(char *devname, int fd, int quiet,
int will_retry);
extern int Manage_subdevs(char *devname, int fd,
@@ -1237,7 +1237,7 @@ extern int WaitClean(char *dev, int sock, int verbose);
extern int Incremental(char *devname, struct context *c,
struct supertype *st);
extern void RebuildMap(void);
-extern int IncrementalScan(int verbose, char *devnm);
+extern int IncrementalScan(struct context *c, char *devnm);
extern int IncrementalRemove(char *devname, char *path, int verbose);
extern int CreateBitmap(char *filename, int force, char uuid[16],
unsigned long chunksize, unsigned long daemon_sleep,
--
1.8.3.1.487.g3e7a5b4

45
boot.md
View File

@ -3,17 +3,17 @@
# SUSE system startup script for MD RAID autostart
# Copyright (C) 1995--2005 Kurt Garloff, SUSE / Novell Inc.
# Copyright (C) 2006 Marian Jancar, SUSE / Novell Inc.
#
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
@ -36,7 +36,7 @@
### END INIT INFO
# Source LSB init functions
# providing start_daemon, killproc, pidofproc,
# providing start_daemon, killproc, pidofproc,
# log_success_msg, log_failure_msg and log_warning_msg.
# This is currently not used by UnitedLinux based distributions and
# not needed for init scripts for UnitedLinux only. If it is used,
@ -70,7 +70,7 @@ rc_reset
# 6 - program is not configured
# 7 - program is not running
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
#
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
@ -97,16 +97,14 @@ function _rc_exit {
case "$1" in
start)
echo -n "Starting MD RAID "
mkdir -p /run/mdadm
# restart mdmon (exits silently if there is nothing to monitor)
/sbin/mdmon --all --takeover --offroot
# Check for existence of needed config file and read it
[ -r $mdadm_SYSCONFIG ] || _rc_exit 6 "... $mdadm_SYSCONFIG not existing "
# Read config
. $mdadm_SYSCONFIG
[ "x$MDADM_CONFIG" != x"" ] && mdadm_CONFIG="$MDADM_CONFIG"
# Check for missing binaries (stale symlinks should not happen)
@ -116,22 +114,8 @@ case "$1" in
[ ! -f /proc/mdstat -a -x /sbin/modprobe ] && /sbin/modprobe md_mod
[ -f /proc/mdstat ] || _rc_exit 5 "... no MD support in kernel "
# Wait for udev to settle
if [ "$MDADM_DEVICE_TIMEOUT" -gt 0 ] ; then
/sbin/udevadm settle --timeout="$MDADM_DEVICE_TIMEOUT"
fi
if ! grep -qs '^[^#]*[^[:blank:]#]' $mdadm_CONFIG; then
# empty or missing /etc/mdadm.conf, "unused"
rc_status -u
else
# firstly finish any incremental assembly that has started.
$mdadm_BIN -IRs
$mdadm_BIN -A -s -c $mdadm_CONFIG
# a status of 2 is not an error
test $? -eq 0 -o $? -eq 2
rc_status -v
fi
# leave all array assembly to udev.
rc_status -v
;;
stop)
echo -n "Not shutting down MD RAID - reboot/halt scripts do this."
@ -151,11 +135,12 @@ case "$1" in
rc_status -v
;;
reload)
# We cannot really reload the kernel module, or reassemble the
# arrays, but we can restart mdmon. It will replace existing
# mdmon, or exit quietly if there is nothing to do.
echo -n "MD RAID: restarting mdmon if it is needed."
/sbin/mdmon --all --takeover --offroot
# There isn't much that is useful to do.
# We cannot reload the kernel module, or reassemble the
# arrays. Restarting mdmon is pointless and might be bad
# as mdmon might be running in the initrd.
# We could start and newly-degraded arrays.
/sbin/mdadm -IRs
rc_status -v
;;
*)

View File

@ -0,0 +1,29 @@
From dbdf3f15e7ed9d5462a6ece09dd1c57ca430d912 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 10 Sep 2013 17:10:10 +1000
Subject: [PATCH] config: set "auto_seen" after processing the auto line.
Otherwise when we process an empty autoline (to be sure to
capture the MDADM_CONF_AUTO environment variable) we can end up
setting everything to 'yes' which over-rides 'no'.
Signed-off-by: NeilBrown <neilb@suse.de>
---
config.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/config.c b/config.c
index f1a70c5..a35807c 100644
--- a/config.c
+++ b/config.c
@@ -575,6 +575,7 @@ void autoline(char *line)
if (auto_seen)
return;
+ auto_seen = 1;
/* Parse the 'auto' line creating policy statements for the 'auto' policy.
*
--
1.8.3.1.487.g3e7a5b4

View File

@ -1,3 +1,40 @@
-------------------------------------------------------------------
Fri Sep 13 01:46:00 UTC 2013 - nfbrown@suse.com
- boot.md - simplify boot.
As array assembly is done by udev, it shouldn't
be done by boot.md. This will avoid some problems
with arrays getting started degraded.
-------------------------------------------------------------------
Fri Sep 13 00:59:15 UTC 2013 - nfbrown@suse.com
- Make-IRs-and-run-work-properly-for-containers.patch
- mdmon-honour-offroot-again.patch
Upstream fixes
-------------------------------------------------------------------
Thu Sep 12 01:12:36 UTC 2013 - nfbrown@suse.com
- config-set-auto_seen-after-processing-the-auto-line.patch
Fix bug which causes "AUTO -all" in mdadm.conf
in initrd to be ignored, so array might be
auto-assembled too early.
-------------------------------------------------------------------
Thu Sep 12 01:05:03 UTC 2013 - nfbrown@suse.com
- mkinitrd-boot.sh: simplify boot sequence by relying
completely on udev running "mdadm -I". Thus
mkinitrd-boot.sh needs to do very little.
The devfunction script in the mkinitrd package has
been modified to start newly degraded array after
a suitable timeout.
- mkinitrd-setup.sh:
- don't save md_devs as it isn't used any more
- allow md device names like "/dev/md_foo" which will
need to be supported in due course.
-------------------------------------------------------------------
Mon Sep 9 03:06:20 UTC 2013 - nfbrown@suse.com

View File

@ -43,6 +43,14 @@ Source5: mkinitrd-setup.sh
Source6: mkinitrd-boot.sh
Source7: mdadm.cron
Source8: mdadm.shutdown
# PATCH-FIX-UPSTREAM config-set-auto_seen-after-processing-the-auto-line.patch upstream-bugfix nfbrown@suse.de
Patch1: config-set-auto_seen-after-processing-the-auto-line.patch
# PATCH-FIX-UPSTREAM DDF-allow-for-possibility-that-there-is-no-secondary.patch upstream-bugfix nfbrown@suse.de
Patch2: DDF-allow-for-possibility-that-there-is-no-secondary.patch
# PATCH-FIX-UPSTREAM Make-IRs-and-run-work-properly-for-containers.patch upstream-bugfix nfbrown@suse.de
Patch3: Make-IRs-and-run-work-properly-for-containers.patch
# PATCH-FIX-UPSTREAM mdmon-honour-offroot-again.patch upstream-bugfix nfbrown@suse.de
Patch4: mdmon-honour-offroot-again.patch
%define _udevdir %(pkg-config --variable=udevdir udev)
%define _systemdshutdowndir %{_unitdir}/../system-shutdown
@ -54,6 +62,10 @@ programs but with a very different interface.
%prep
%setup -q -a1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error"

View File

@ -0,0 +1,40 @@
From 5d79c72e16b32d7d6d0f535348286a7f2a966092 Mon Sep 17 00:00:00 2001
From: "mwilck@arcor.de" <mwilck@arcor.de>
Date: Wed, 11 Sep 2013 22:15:19 +0200
Subject: [PATCH] mdmon: honour --offroot, again
commit 3e32ba9d removed support for --offroot, and a9c15847 made
mdmon use @ in argv[0] only when started from initrd.
This breaks mdadm in OpenSUSE 12.3, which starts mdmon from the
root file system and relies on --offroot to work as documented earlier.
Reintroducing --offroot as an undocumented option, as its use is going to
go away soon anyway.
If this can't be applied, it should probably be included as distro-specific
patch if mdadm 3.3 is built for OpenSUSE 12.3. I haven't checked if the
patch is necesary for OpenSUSE Factory, too.
Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
---
mdmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mdmon.c b/mdmon.c
index f0b0623..8cd53d8 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
dofork = 0;
break;
case OffRootOpt:
- /* silently ignore old option */
+ argv[0][0] = '@';
break;
case 'h':
default:
--
1.8.3.1.487.g3e7a5b4

View File

@ -1,32 +1,28 @@
#!/bin/bash
#%stage: softraid
# grep needed for udev rules file.
#%stage: boot
#%depends: start
#%programs: /sbin/mdadm /sbin/mdmon
#%modules: raid0 raid1 raid10 raid456
#%if: -n "$need_mdadm"
#
##### MD (Software-)Raid
##
## This activates and waits for an MD software raid.
## This only sets the 'start_ro' module parameter to ensure
## arrays don't start resync until after the first write.
## All array assembly is performed by udev -> "mdadm -I"
##
## Command line parameters
## -----------------------
##
## need_mdadm=1 use MD raid
##
##
# load the necessary module before we initialize the raid system
load_modules
# Create dir for socket and pid files
mkdir -p /run/mdadm
[ "$mduuid" ] && md_uuid="$mduuid"
#check_for_device uses $md_major
#we depend on 'start' to ensure /proc/devices exists
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
if [ -n "$md_major" -a "$md_major" = "$maj" ]; then
md_minor="$min"
md_dev="/dev/md$md_minor"
fi
# Always start md devices read/only. They will get set to rw as soon
# as the first write occurs. This way we can guarantee that no
@ -34,114 +30,3 @@ fi
if [ -f /sys/module/md_mod/parameters/start_ro ]; then
echo 1 > /sys/module/md_mod/parameters/start_ro
fi
if test -n "$debug_linuxrc"; then
mdadm="mdadm -v"
else
mdadm="mdadm"
fi
# uuid -> array name
get_md_name()
{
local uuid=$1 res
if ! test -f /etc/mdadm.conf; then
return 1
fi
res=$(sed -rn "s/^ARRAY +([^ ]+).* UUID=$uuid.*/\1/p" /etc/mdadm.conf)
case "$res" in
"" | \<* | *=*)
return 1
;;
/*)
echo "$res"
;;
*)
echo "/dev/md/$res"
;;
esac
return 0
}
md_assemble()
{
local dev=$1 type=$2 uuid mdconf container container_name
if test -e "$dev"; then
return
fi
case "$dev" in
/dev/md[0-9]*p[0-9]*)
dev=${dev%p[0-9]*}
;;
/dev/md*)
;;
/dev/disk/by-id/md-uuid-*)
uuid=${dev#/dev/disk/by-id/md-uuid-}
uuid=${uuid%-part*}
dev=
;;
*)
return
esac
if test -f /etc/mdadm.conf; then
mdconf="-c /etc/mdadm.conf"
local line
if test -n "$dev"; then
line=$(sed -rn "\:^ARRAY +$dev :p" /etc/mdadm.conf)
else
line=$(sed -rn "/^ARRAY .* UUID=$uuid/p" /etc/mdadm.conf)
fi
container=$(echo "$line" | \
sed -rn 's/.* container=([^ ]*).*/\1/p')
else
mdconf="-c partitions"
fi
case "$container" in
"")
;;
/dev/*)
$mdadm -A $mdconf $container --offroot
;;
[0-9a-f]*[0-9a-f])
container_name=$(get_md_name "$container")
if test -z "$container_name"; then
container_name=/dev/md/container
fi
$mdadm -A $mdconf --uuid="$container" "$container_name" --offroot
;;
*)
echo "unrecognized container for $dev: $container"
esac
if test -n "$dev"; then
$mdadm -A $mdconf "$dev" --offroot
else
dev=$(get_md_name "$uuid")
if test -z "$dev"; then
# mdadm will pick a device name
$mdadm -A $mdconf --uuid=$uuid --offroot
else
$mdadm -A $mdconf --uuid=$uuid "$dev" --offroot
fi
fi
# If md and multipath are used, md is not top. Clear
# the {root,resume}_major setting from boot-multipath.sh
local var=${type}_major
read $var </dev/null
}
# run any degraded arrays assembled incrementally
wait_for_events
$mdadm --incremental --run --scan --offroot
md_assemble "$resumedev" "resume"
md_assemble "$rootdev" "root"
if [ -n "$md_dev" ] ; then
md_assemble "$md_dev"
fi
# assemble any md devices seen by setup-md.sh at initrd build time
for dev in $md_devs; do
md_assemble "$dev"
done
wait_for_events

View File

@ -16,12 +16,12 @@ declare -A md_conf
for bd in $blockdev ; do
is_part_dev=false
case $bd in
/dev/md[0-9]*p[0-9]*)
/dev/md[_0-9]*p[0-9]* )
# Partitionable MD RAID. This is partition on RAID. Get the RAID
bd=${bd%%p[0-9]*}
is_part_dev=true
;;
/dev/md[0-9]*)
/dev/md[0-9_]*)
;;
*)
mdblockdev="$mdblockdev $bd"
@ -95,12 +95,6 @@ if [ -n "$root_md" ] ; then
echo -e "${md_conf["$md"]}" >> $tmp_mnt/etc/mdadm.conf
done
fi
# Remember which arrays are needed for the root or swap device and assemble
# them all during boot. The root= or resume= option might not directly refer to
# the array.
if test -n "$md_devs"; then
md_devs=$(printf '/dev/%s ' $md_devs)
fi
if [ "x$need_mdadm" = "x1" ] ; then
for rule in \
@ -115,4 +109,3 @@ if [ "x$need_mdadm" = "x1" ] ; then
fi
save_var need_mdadm
save_var md_devs