]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incremental: honor --no-degraded to delay assembly
authorDan Williams <dan.j.williams@intel.com>
Wed, 25 Feb 2009 01:45:57 +0000 (18:45 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 25 Feb 2009 01:45:57 +0000 (18:45 -0700)
Currently Incremental_container is being called after adding each disk.
In the imsm case where spares are not tracked in the raid_disks field we
can use --no-degraded to block premature assembly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Incremental.c
mdadm.8
mdadm.c

index 0a0dc03762ee430151cf1d16b952ab91dc31683e..e293999e404805aa3bd0a66ad9c4ab2fe6ec30ed 100644 (file)
@@ -398,6 +398,8 @@ int Incremental(char *devname, int verbose, int runstop,
                                ": container %s now has %d devices\n",
                                chosen_name, info.array.working_disks);
                wait_for(chosen_name);
+               if (runstop < 0)
+                       return 0; /* don't try to assemble */
                return Incremental(chosen_name, verbose, runstop,
                                   NULL, homehost, autof);
        }
@@ -405,7 +407,8 @@ int Incremental(char *devname, int verbose, int runstop,
        active_disks = count_active(st, mdfd, &avail, &info);
        if (enough(info.array.level, info.array.raid_disks,
                   info.array.layout, info.array.state & 1,
-                  avail, active_disks) == 0) {
+                  avail, active_disks) == 0 ||
+           (runstop < 0 && active_disks < info.array.raid_disks)) {
                free(avail);
                if (verbose >= 0)
                        fprintf(stderr, Name
diff --git a/mdadm.8 b/mdadm.8
index b474bc1c890f69f58dba87e425d45af923dd2afa..1b9071f8f9b032af6fd1498442b83cc6d5f9889a 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -1116,6 +1116,11 @@ uses to help track which arrays are currently being assembled.
 Run any array assembled as soon as a minimal number of devices are
 available, rather than waiting until all expected devices are present.
 
+.TP
+.B \-\-no\-degraded
+This allows the hot-plug system to prevent arrays from running when it knows
+that more disks may arrive later in the discovery process.
+
 .TP
 .BR \-\-scan ", " \-s
 Only meaningful with
diff --git a/mdadm.c b/mdadm.c
index 1f9b707cae9abea3fab60bbc57b63af15504ec37..72e7926f0ed8417d85355fa10b90e69f5d345d64 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -644,6 +644,7 @@ int main(int argc, char *argv[])
                "     'summaries', 'homehost', 'byteorder', 'devicesize'.\n");
                        exit(outf == stdout ? 0 : 2);
 
+               case O(INCREMENTAL,NoDegraded):
                case O(ASSEMBLE,NoDegraded): /* --no-degraded */
                        runstop = -1; /* --stop isn't allowed for --assemble,
                                       * so we overload slightly */