imsm: fix failed disks are allowed back into the container

Failed disks do not have valid serial numbers which means we will not
pick up the 'failed' status bit from the metadata entry.  Check for
dl->index == -2 to prevent failed disks from being incorporated into the
container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2009-01-23 15:45:34 -07:00
parent 5615172f1d
commit caf8d23175
1 changed files with 4 additions and 1 deletions

View File

@ -1195,8 +1195,11 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
info->component_size = reserved;
s = disk->status;
info->disk.state = s & CONFIGURED_DISK ? (1 << MD_DISK_ACTIVE) : 0;
info->disk.state |= s & FAILED_DISK ? (1 << MD_DISK_FAULTY) : 0;
info->disk.state |= s & SPARE_DISK ? 0 : (1 << MD_DISK_SYNC);
if (s & FAILED_DISK || super->disks->index == -2) {
info->disk.state |= 1 << MD_DISK_FAULTY;
info->disk.raid_disk = -2;
}
}
/* only call uuid_from_super_imsm when this disk is part of a populated container,