]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
Don't set 'hold' option for mdstat_read if not needed.
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index 83f1caa90f83fe4dee8cbed00124045378772487..a46a716b29617014aeb6aab83698ce465467f3e5 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -29,7 +29,6 @@
 #include "md_p.h"
 #include <ctype.h>
 
-
 static int scan_assemble(struct supertype *ss,
                         struct context *c,
                         struct mddev_ident *ident);
@@ -40,7 +39,6 @@ static int misc_list(struct mddev_dev *devlist,
                     char *dump_directory,
                     struct supertype *ss, struct context *c);
 
-
 int main(int argc, char *argv[])
 {
        int mode = 0;
@@ -423,7 +421,6 @@ int main(int argc, char *argv[])
                        writemostly = 2;
                        continue;
 
-
                case O(GROW,'z'):
                case O(CREATE,'z'):
                case O(BUILD,'z'): /* size */
@@ -757,6 +754,8 @@ int main(int argc, char *argv[])
                                continue;
                        if (strcmp(c.update, "metadata") == 0)
                                continue;
+                       if (strcmp(c.update, "revert-reshape") == 0)
+                               continue;
                        if (strcmp(c.update, "byteorder")==0) {
                                if (ss) {
                                        pr_err("must not set metadata"
@@ -787,7 +786,7 @@ int main(int argc, char *argv[])
                        fprintf(outf, "Valid --update options are:\n"
                "     'sparc2.2', 'super-minor', 'uuid', 'name', 'resync',\n"
                "     'summaries', 'homehost', 'byteorder', 'devicesize',\n"
-               "     'no-bitmap', 'metadata'\n");
+               "     'no-bitmap', 'metadata', 'revert-reshape'\n");
                        exit(outf == stdout ? 0 : 2);
 
                case O(MANAGE,'U'):
@@ -828,6 +827,7 @@ int main(int argc, char *argv[])
                case O(MISC, ConfigFile):
                case O(MONITOR,'c'):
                case O(MONITOR,ConfigFile):
+               case O(CREATE,ConfigFile):
                        if (configfile) {
                                pr_err("configfile cannot be set twice.  "
                                        "Second value is %s.\n", optarg);
@@ -1299,8 +1299,10 @@ int main(int argc, char *argv[])
                                            c.update, c.force);
                if (!rv && c.readonly < 0)
                        rv = Manage_ro(devlist->devname, mdfd, c.readonly);
-               if (!rv && c.runstop)
-                       rv = Manage_runstop(devlist->devname, mdfd, c.runstop, c.verbose, 0);
+               if (!rv && c.runstop > 0)
+                       rv = Manage_run(devlist->devname, mdfd, c.verbose);
+               if (!rv && c.runstop < 0)
+                       rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0);
                break;
        case ASSEMBLE:
                if (devs_found == 1 && ident.uuid_set == 0 &&
@@ -1488,7 +1490,7 @@ int main(int argc, char *argv[])
                                break;
                        }
                }
-               if (devs_found > 1 && s.raiddisks == 0) {
+               if (devs_found > 1 && s.raiddisks == 0 && s.level == UnSet) {
                        /* must be '-a'. */
                        if (s.size > 0 || s.chunk || s.layout_str != NULL || s.bitmap_file) {
                                pr_err("--add cannot be used with "
@@ -1607,7 +1609,7 @@ static int scan_assemble(struct supertype *ss,
                        if (a->devname &&
                            strcasecmp(a->devname, "<ignore>") == 0)
                                continue;
-                               
+
                        r = Assemble(ss, a->devname,
                                     a, NULL, c);
                        if (r == 0) {
@@ -1725,7 +1727,7 @@ static int stop_scan(int verbose)
                        }
                        mdfd = open_mddev(name, 1);
                        if (mdfd >= 0) {
-                               if (Manage_runstop(name, mdfd, -1, verbose, !last))
+                               if (Manage_stop(name, mdfd, verbose, !last))
                                        err = 1;
                                else
                                        progress = 1;
@@ -1799,13 +1801,19 @@ static int misc_list(struct mddev_dev *devlist,
                                               (dv == devlist && dv->next == NULL));
                        continue;
                }
-               mdfd = open_mddev(dv->devname, 1);
+               if (dv->devname[0] == '/')
+                       mdfd = open_mddev(dv->devname, 1);
+               else {
+                       mdfd = open_dev(dv->devname);
+                       if (mdfd < 0)
+                               pr_err("Cannot open %s\n", dv->devname);
+               }
                if (mdfd>=0) {
                        switch(dv->disposition) {
                        case 'R':
-                               rv |= Manage_runstop(dv->devname, mdfd, 1, c->verbose, 0); break;
+                               rv |= Manage_run(dv->devname, mdfd, c->verbose); break;
                        case 'S':
-                               rv |= Manage_runstop(dv->devname, mdfd, -1, c->verbose, 0); break;
+                               rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0); break;
                        case 'o':
                                rv |= Manage_ro(dv->devname, mdfd, 1); break;
                        case 'w':