diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-08-19 17:55:15 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-08-19 17:55:15 +1000 |
commit | 6c386dd368ca1d24554fbf700239e8aa222591fb (patch) | |
tree | 05139ef181aeec2489914dfcfb50649e5abc5bae /super-intel.c | |
parent | 567df5fd0a18ed8eed6ee24fb7991b963f56efa0 (diff) | |
download | mdadm-6c386dd368ca1d24554fbf700239e8aa222591fb.tar.gz mdadm-6c386dd368ca1d24554fbf700239e8aa222591fb.tar.xz mdadm-6c386dd368ca1d24554fbf700239e8aa222591fb.zip |
imsm: allow container assembly in the presence of failed disks
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>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/super-intel.c b/super-intel.c index 7a19935..b78b529 100644 --- a/super-intel.c +++ b/super-intel.c @@ -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; } |