summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-08-12 02:25:46 -0700
committerDan Williams <dan.j.williams@intel.com>2008-08-12 02:25:46 -0700
commit272906ef4906002a4238e0388fa2e7e8387995ad (patch)
treee477f2bc157a676fbc4bffc8b912388624efa8b1 /monitor.c
parent3393c6af8b740131632197b2908ef91467d85160 (diff)
mdmon: use activate spare for re-add
Disks that are not in-sync or failed are not assembled into member arrays by mdadm. Teach mdmon to resolve this situation by checking for spares at start. imsm_activate_spare() is updated to prefer devices that can be re-added versus new spares. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/monitor.c b/monitor.c
index 7cce5a8b..382cad44 100644
--- a/monitor.c
+++ b/monitor.c
@@ -243,10 +243,15 @@ static int read_and_act(struct active_array *a)
* readonly ???
*/
get_resync_start(a);
-// printf("Found a readonly array at %llu\n", a->resync_start);
- if (a->resync_start == ~0ULL)
+ if (a->resync_start == ~0ULL) {
a->next_state = read_auto; /* array is clean */
- else {
+ /* give the metadata a chance to force active if
+ * we have some recovery to do. metadata sets
+ * resync_start to !MaxSector in this case
+ */
+ a->container->ss->set_array_state(a, 1);
+ }
+ if (a->resync_start != ~0ULL) {
a->container->ss->set_array_state(a, 0);
a->next_state = active;
}