diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-02-23 23:06:24 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-02-23 23:06:24 -0700 |
commit | df4746577e79650f8549555a1bdd083ffb8415b6 (patch) | |
tree | 38ab9a5bedd51daaaca6c1343fd50f9be9e483ea /super-intel.c | |
parent | 7a70e8aa8d47376ca37a1fe2c38f1db5c14aa36d (diff) | |
download | mdadm-df4746577e79650f8549555a1bdd083ffb8415b6.tar.gz mdadm-df4746577e79650f8549555a1bdd083ffb8415b6.tar.xz mdadm-df4746577e79650f8549555a1bdd083ffb8415b6.zip |
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 <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 19 |
1 files changed, 10 insertions, 9 deletions
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; } |