]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
Specify nodes number when updating cluster nodes
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index 5afe4155d7011f2f3b653ff162dedeb940cdd911..1b3467fd47792d8f98da0c822c1e611ce1065b93 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -159,6 +159,10 @@ int main(int argc, char *argv[])
                        c.brief = 1;
                        continue;
 
+               case NoDevices:
+                       c.no_devices = 1;
+                       continue;
+
                case 'Y': c.export++;
                        continue;
 
@@ -546,6 +550,14 @@ int main(int argc, char *argv[])
                                pr_err("raid level must be given before layout.\n");
                                exit(2);
 
+                       case 0:
+                               s.layout = map_name(r0layout, optarg);
+                               if (s.layout == UnSet) {
+                                       pr_err("layout %s not understood for raid0.\n",
+                                               optarg);
+                                       exit(2);
+                               }
+                               break;
                        case 5:
                                s.layout = map_name(r5layout, optarg);
                                if (s.layout == UnSet) {
@@ -783,6 +795,9 @@ int main(int argc, char *argv[])
                                continue;
                        if (strcmp(c.update, "revert-reshape") == 0)
                                continue;
+                       if (strcmp(c.update, "layout-original") == 0 ||
+                           strcmp(c.update, "layout-alternate") == 0)
+                               continue;
                        if (strcmp(c.update, "byteorder") == 0) {
                                if (ss) {
                                        pr_err("must not set metadata type with --update=byteorder.\n");
@@ -813,6 +828,7 @@ int main(int argc, char *argv[])
                "     'summaries', 'homehost', 'home-cluster', 'byteorder', 'devicesize',\n"
                "     'no-bitmap', 'metadata', 'revert-reshape'\n"
                "     'bbl', 'no-bbl', 'force-no-bbl', 'ppl', 'no-ppl'\n"
+               "     'layout-original', 'layout-alternate'\n"
                                );
                        exit(outf == stdout ? 0 : 2);
 
@@ -1417,6 +1433,11 @@ int main(int argc, char *argv[])
                }
        }
 
+       if (c.update && strcmp(c.update, "nodes") == 0 && c.nodes == 0) {
+               pr_err("Please specify nodes number with --nodes\n");
+               exit(1);
+       }
+
        if (c.backup_file && data_offset != INVALID_SECTORS) {
                pr_err("--backup-file and --data-offset are incompatible\n");
                exit(2);
@@ -1469,9 +1490,12 @@ int main(int argc, char *argv[])
                        rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0);
                break;
        case ASSEMBLE:
-               if (devs_found == 1 && ident.uuid_set == 0 &&
-                   ident.super_minor == UnSet && ident.name[0] == 0 &&
-                   !c.scan ) {
+               if (!c.scan && c.runstop == -1) {
+                       pr_err("--no-degraded not meaningful without a --scan assembly.\n");
+                       exit(1);
+               } else if (devs_found == 1 && ident.uuid_set == 0 &&
+                          ident.super_minor == UnSet && ident.name[0] == 0 &&
+                          !c.scan) {
                        /* Only a device has been given, so get details from config file */
                        struct mddev_ident *array_ident = conf_get_ident(devlist->devname);
                        if (array_ident == NULL) {
@@ -1885,6 +1909,8 @@ static int misc_scan(char devmode, struct context *c)
                        else
                                rv |= WaitClean(name, c->verbose);
                        put_md_name(name);
+                       map_free(map);
+                       map = NULL;
                }
        }
        free_mdstat(ms);
@@ -1957,7 +1983,7 @@ static int misc_list(struct mddev_dev *devlist,
                                        rv |= Kill(dv->devname, NULL, c->force, v, 0);
                                        v = -1;
                                } while (rv == 0);
-                               rv &= ~2;
+                               rv &= ~4;
                        }
                        continue;
                case 'Q':