Assemble: don't ever consider a 'spare' to be the 'most recent'.
If all devices have the same event count and the first one is a spare, then that spare will be the 'most_recent'. However then other devices will think the 'most_recent' has failed (for v0.90 metadata) and will be rejected from the array. So never consider a 'spare' to be 'most recent'. Reported-by: Andreas Baer <synthetic.gods@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
2f1bcf43d9
commit
a792ece676
13
Assemble.c
13
Assemble.c
|
@ -564,7 +564,7 @@ static int load_devices(struct devs *devices, char *devmap,
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
int bitmap_done = 0;
|
int bitmap_done = 0;
|
||||||
#endif
|
#endif
|
||||||
int most_recent = 0;
|
int most_recent = -1;
|
||||||
int bestcnt = 0;
|
int bestcnt = 0;
|
||||||
int *best = *bestp;
|
int *best = *bestp;
|
||||||
|
|
||||||
|
@ -695,10 +695,12 @@ static int load_devices(struct devs *devices, char *devmap,
|
||||||
devices[devcnt].i.disk.major = major(stb.st_rdev);
|
devices[devcnt].i.disk.major = major(stb.st_rdev);
|
||||||
devices[devcnt].i.disk.minor = minor(stb.st_rdev);
|
devices[devcnt].i.disk.minor = minor(stb.st_rdev);
|
||||||
|
|
||||||
if (devices[devcnt].i.events
|
if (devices[devcnt].i.disk.state == 6) {
|
||||||
> devices[most_recent].i.events &&
|
if (most_recent < 0 ||
|
||||||
devices[devcnt].i.disk.state == 6)
|
devices[devcnt].i.events
|
||||||
|
> devices[most_recent].i.events)
|
||||||
most_recent = devcnt;
|
most_recent = devcnt;
|
||||||
|
}
|
||||||
|
|
||||||
if (content->array.level == LEVEL_MULTIPATH)
|
if (content->array.level == LEVEL_MULTIPATH)
|
||||||
/* with multipath, the raid_disk from the superblock is meaningless */
|
/* with multipath, the raid_disk from the superblock is meaningless */
|
||||||
|
@ -766,7 +768,8 @@ static int load_devices(struct devs *devices, char *devmap,
|
||||||
}
|
}
|
||||||
devcnt++;
|
devcnt++;
|
||||||
}
|
}
|
||||||
*most_recentp = most_recent;
|
if (most_recent >= 0)
|
||||||
|
*most_recentp = most_recent;
|
||||||
*bestcntp = bestcnt;
|
*bestcntp = bestcnt;
|
||||||
*bestp = best;
|
*bestp = best;
|
||||||
return devcnt;
|
return devcnt;
|
||||||
|
|
Loading…
Reference in New Issue