]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: allow container assembly in the presence of failed disks
authorDan Williams <dan.j.williams@intel.com>
Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)
For example, this allows one to still say mdadm -A /dev/sd[b-e] even
though /dev/sde has replaced /dev/sdd.  Otherwise mdadm will say:

mdadm: superblock on /dev/sdd doesn't match others - assembly aborted

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

index 7a199353183be4e0b708c0355a69f53666e1f151..b78b5294aa7ceaf434a2c13f3ac052398311f58c 100644 (file)
@@ -789,10 +789,6 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
            sec->anchor->num_raid_devs > 0) {
                if (first->anchor->family_num != sec->anchor->family_num)
                        return 3;
-               if (first->anchor->mpb_size != sec->anchor->mpb_size)
-                       return 3;
-               if (first->anchor->check_sum != sec->anchor->check_sum)
-                       return 3;
        }
 
        return 0;
@@ -910,6 +906,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
                dl->fd = keep_fd ? fd : -1;
                dl->devname = devname ? strdup(devname) : NULL;
                strncpy((char *) dl->serial, (char *) serial, MAX_RAID_SERIAL_LEN);
+               dl->index = -3;
        } else if (keep_fd) {
                close(dl->fd);
                dl->fd = fd;
@@ -930,7 +927,9 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
                        /* only set index on disks that are a member of a
                         * populated contianer, i.e. one with raid_devs
                         */
-                       if (status & SPARE_DISK)
+                       if (status & FAILED_DISK)
+                               dl->index = -2;
+                       else if (status & SPARE_DISK)
                                dl->index = -1;
                        else
                                dl->index = i;
@@ -938,26 +937,16 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
                }
        }
 
-       if (i == super->anchor->num_disks && alloc) {
-               if (devname)
-                       fprintf(stderr,
-                               Name ": failed to load disk with serial \'%s\' for %s\n",
-                               dl->serial, devname);
-               free(dl);
-               return 1;
-       }
-       if (i == super->anchor->num_disks && dl->index >= 0) {
-               if (devname)
-                       fprintf(stderr,
-                               Name ": confused... disk %d with serial \'%s\' "
-                               "is not listed in the current anchor\n",
-                               dl->index, dl->serial);
-               return 1;
+       if (dl->index == -3) {
+               fprintf(stderr, Name ": device %x:%x with serial %s"
+                       " does not belong to this container\n",
+                       dl->major, dl->minor, (char *) serial);
+               return 2;
        }
 
        if (alloc)
                super->disks = dl;
-               
+
        return 0;
 }