When we add a device for re-add we need to use the details of that device, not the details of some other device we just looked at. In particular raid_disk must be correct or the re-add doesn't work. Also getinfo_super1 must report the write-only and failfast flags or they will not be set when the device is re-added. References: bnc#737609 and bnc#737590 Signed-off-by: NeilBrown --- Incremental.c | 7 ++++--- super1.c | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) --- mdadm-3.2.2.orig/Incremental.c +++ mdadm-3.2.2/Incremental.c @@ -415,12 +415,13 @@ int Incremental(char *devname, int verbo goto out_unlock; } } - info2.disk.major = major(stb.st_rdev); - info2.disk.minor = minor(stb.st_rdev); + info.disk.major = major(stb.st_rdev); + info.disk.minor = minor(stb.st_rdev); /* add disk needs to know about containers */ if (st->ss->external) sra->array.level = LEVEL_CONTAINER; - err = add_disk(mdfd, st, sra, &info2); + err = add_disk(mdfd, st, sra, &info); + if (err < 0 && errno == EBUSY) { /* could be another device present with the same * disk.number. Find and reject any such --- mdadm-3.2.2.orig/super1.c +++ mdadm-3.2.2/super1.c @@ -605,6 +605,10 @@ static void getinfo_super1(struct supert info->disk.state = 6; /* active and in sync */ info->disk.raid_disk = role; } + if (sb->devflags & WriteMostly1) + info->disk.state |= (1 << MD_DISK_WRITEMOSTLY); + if (sb->devflags & FailFast1) + info->disk.state |= (1 << MD_DISK_FAILFAST); info->events = __le64_to_cpu(sb->events); sprintf(info->text_version, "1.%d", st->minor_version); info->safe_mode_delay = 200;