summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-26 03:11:57 +0000
committerNeil Brown <neilb@suse.de>2006-05-26 03:11:57 +0000
commitd55e3aefc00b6762338c2676934c3bb19ed4da4b (patch)
tree45102805b14aa19157e0b8bd9411d1d0f2390e97 /mdadm.c
parent2e2642f2c530369ff4f905932860681a48ca4d22 (diff)
downloadmdadm-d55e3aefc00b6762338c2676934c3bb19ed4da4b.tar.gz
mdadm-d55e3aefc00b6762338c2676934c3bb19ed4da4b.tar.xz
mdadm-d55e3aefc00b6762338c2676934c3bb19ed4da4b.zip
Support auto-assembling of stacked devices
and assorted bugfixes. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/mdadm.c b/mdadm.c
index 6c30058..ff656e4 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -873,6 +873,8 @@ int main(int argc, char *argv[])
fprintf(stderr, Name ": --super-minor=dev is incompatible with --auto\n");
exit(2);
}
+ if (mode == MANAGE && runstop < 0)
+ autof=1; /* Don't create */
mdfd = open_mddev(devlist->devname, autof);
if (mdfd < 0)
exit(1);
@@ -1022,15 +1024,23 @@ int main(int argc, char *argv[])
* until it fails
*/
int rv2;
+ int acnt;
+ ident.autof = autof;
do {
- ident.autof = autof;
- rv2 = Assemble(ss, NULL, -1,
- &ident, configfile,
- devlist, NULL,
- readonly, runstop, NULL, homehost, verbose-quiet, force);
- if (rv2==0)
- cnt++;
- } while (rv2==0);
+ acnt = 0;
+ do {
+ rv2 = Assemble(ss, NULL, -1,
+ &ident, configfile,
+ devlist, NULL,
+ readonly, runstop, NULL, homehost, verbose-quiet, force);
+ if (rv2==0) {
+ cnt++;
+ acnt++;
+ }
+ } while (rv2!=2);
+ /* Incase there are stacked devices, we need to go around again */
+ devlist = conf_get_devs(configfile);
+ } while (acnt);
if (cnt == 0 && rv == 0) {
fprintf(stderr, Name ": No arrays found in config file or automatically\n");
rv = 1;
@@ -1125,7 +1135,7 @@ int main(int argc, char *argv[])
e->dev);
continue;
}
- mdfd = open_mddev(name, 0);
+ mdfd = open_mddev(name, 1);
if (mdfd >= 0) {
if (Manage_runstop(name, mdfd, -1, !last))
err = 1;
@@ -1154,7 +1164,7 @@ int main(int argc, char *argv[])
case 'X':
rv |= ExamineBitmap(dv->devname, brief, ss); continue;
}
- mdfd = open_mddev(dv->devname, 0);
+ mdfd = open_mddev(dv->devname, 1);
if (mdfd>=0) {
switch(dv->disposition) {
case 'R':