Fix a recently introduced bug, and make --assemble more resilient to it.

Make -assemble a bit more resilient to finding strange
 information in superblocks.
Don't claim newly added spares are InSync!! (don't know why that
 code was ever in there)
This commit is contained in:
Neil Brown 2006-06-26 12:26:12 +10:00
parent 7eae7080e2
commit 08110d41bc
3 changed files with 9 additions and 1 deletions

View File

@ -499,6 +499,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
if (nextspare < info.array.raid_disks)
nextspare = info.array.raid_disks;
i = nextspare++;
} else {
if (i >= info.array.raid_disks &&
i >= nextspare)
nextspare = i+1;
}
if (i < 10000) {
if (i >= bestcnt) {

View File

@ -6,6 +6,10 @@ Changes Prior to this release
to make it a bit easier to see what is happening.
- Work around bug in --add handling for version-1 superblocks
in 2.6.17 (and prior).
- Make -assemble a bit more resilient to finding strange
information in superblocks.
- Don't claim newly added spares are InSync!! (don't know why that
code was ever in there)
Changes Prior to 2.5.1 release
- Various fixes for gcc warnings

View File

@ -350,6 +350,7 @@ static void getinfo_super0(struct mdinfo *info, void *sbv)
/* work_disks is calculated rather than read directly */
for (i=0; i < MD_SB_DISKS; i++)
if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
(sb->disks[i].raid_disk < info->array.raid_disks) &&
(sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
!(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
working ++;
@ -647,7 +648,6 @@ static int write_init_super0(struct supertype *st, void *sbv, mdu_disk_info_t *d
}
sb->disks[dinfo->number].state &= ~(1<<MD_DISK_FAULTY);
sb->disks[dinfo->number].state |= (1<<MD_DISK_SYNC);
sb->this_disk = sb->disks[dinfo->number];
sb->sb_csum = calc_sb0_csum(sb);