]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Don't allow spares when creating 'external' arrays.
authorNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 06:03:08 +0000 (16:03 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 06:03:08 +0000 (16:03 +1000)
It is meaningless when creating the container, and for
subarrays, the container is responsible for assigning
spares.

Also, don't do the 'spare' fiddle for raid5 as we cannot
set up a spare at this point yet.  Later maybe just create
the array degraded and let the container sort it out.

Create.c

index 652bc1c761cbdd7e9a30839f33f29000e7d95a32..7a4a81dfa674912b32a6e5d7494bb83535a4e200 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -166,6 +166,12 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                        devlist = NULL;
                }
        }
                        devlist = NULL;
                }
        }
+       if (st && st->ss->external && sparedisks) {
+               fprintf(stderr,
+                       Name ": This metadata type does not support "
+                       "spare disks are create time\n");
+               return 1;
+       }
        if (subdevs > raiddisks+sparedisks) {
                fprintf(stderr, Name ": You have listed more devices (%d) than are in the array(%d)!\n", subdevs, raiddisks+sparedisks);
                return 1;
        if (subdevs > raiddisks+sparedisks) {
                fprintf(stderr, Name ": You have listed more devices (%d) than are in the array(%d)!\n", subdevs, raiddisks+sparedisks);
                return 1;
@@ -411,6 +417,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
         * into a spare, else the create will fail
         */
        if (assume_clean == 0 && force == 0 && first_missing < raiddisks &&
         * into a spare, else the create will fail
         */
        if (assume_clean == 0 && force == 0 && first_missing < raiddisks &&
+           st->ss->external == 0 &&
            second_missing >= raiddisks && level == 6) {
                insert_point = raiddisks - 1;
                if (insert_point == first_missing)
            second_missing >= raiddisks && level == 6) {
                insert_point = raiddisks - 1;
                if (insert_point == first_missing)