From: Dan Williams Date: Fri, 23 Jan 2009 22:45:34 +0000 (-0700) Subject: imsm: fix failed disks are allowed back into the container X-Git-Tag: mdadm-3.0-devel3~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caf8d2317519df27b805919c3878fe3c3acc6923;p=thirdparty%2Fmdadm.git 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 --- diff --git a/super-intel.c b/super-intel.c index 0a7c34a2..5c9f4136 100644 --- a/super-intel.c +++ b/super-intel.c @@ -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,