From df4746577e79650f8549555a1bdd083ffb8415b6 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 23 Feb 2009 23:06:24 -0700 Subject: imsm: fix activate spare to ignore foreign disks A foreign disk is one that all other drives believe is not-in-sync but does not have the 'failed' status bit set. This also reverts, because that commit is addressing the wrong problem. Ideally mdmon would kick "non-fresh" drives like the kernel does at native-md activation time, but that is too awkward to implement at the moment because mdadm owns container manipulations. Signed-off-by: Dan Williams --- super-intel.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'super-intel.c') diff --git a/super-intel.c b/super-intel.c index be01f32..c514b44 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1221,11 +1221,12 @@ 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; + /* we don't change info->disk.raid_disk here because + * this state will be finalized in mdmon after we have + * found the 'most fresh' version of the metadata + */ + 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, @@ -3573,11 +3574,11 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot, continue; /* skip in use or failed drives */ - if (dl->disk.status & FAILED_DISK || idx == dl->index) { - dprintf("%x:%x status ( %s%s)\n", - dl->major, dl->minor, - dl->disk.status & FAILED_DISK ? "failed " : "", - idx == dl->index ? "in use " : ""); + if (dl->disk.status & FAILED_DISK || idx == dl->index || + dl->index == -2) { + dprintf("%x:%x status (failed: %d index: %d)\n", + dl->major, dl->minor, + (dl->disk.status & FAILED_DISK) == FAILED_DISK, idx); continue; } -- cgit