From bf2f00718640b5c5cad3076344d347d885b523f9 Mon Sep 17 00:00:00 2001 From: Adam Kwolek Date: Tue, 6 Dec 2011 11:27:57 +1100 Subject: [PATCH] imsm: FIX: Finalize degraded migration Currently mdadm for IMSM can finalize not-degraded migration only. Add support for IMSM for migration finalization when array are is degraded state. Signed-off-by: Adam Kwolek Signed-off-by: NeilBrown --- super-intel.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/super-intel.c b/super-intel.c index 5ad810c6..5827d139 100644 --- a/super-intel.c +++ b/super-intel.c @@ -6416,20 +6416,24 @@ static void imsm_set_disk(struct active_array *a, int n, int state) a->last_checkpoint = 0; } else if (is_gen_migration(dev)) { dprintf("imsm: Detected General Migration in state: "); - if (map_state == IMSM_T_STATE_NORMAL) { - end_migration(dev, map_state); + + switch (map_state) { + case IMSM_T_STATE_NORMAL: + dprintf("normal\n"); + if (a->last_checkpoint >= a->info.component_size) + end_migration(dev, map_state); map = get_imsm_map(dev, 0); map->failed_disk_num = ~0; - dprintf("normal\n"); - } else { - if (map_state == IMSM_T_STATE_DEGRADED) { - printf("degraded\n"); + break; + case IMSM_T_STATE_DEGRADED: + dprintf("degraded\n"); + if (a->last_checkpoint >= a->info.component_size) end_migration(dev, map_state); - } else { - dprintf("failed\n"); - } - map->map_state = map_state; + break; + default: + dprintf("failed\n"); } + map->map_state = map_state; super->updates_pending++; } } -- 2.39.5