Jes Sorensen ec874c8
From 79b68f1b48b0967da999945e310aef628c9bca4c Mon Sep 17 00:00:00 2001
Jes Sorensen ec874c8
From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Jes Sorensen ec874c8
Date: Thu, 18 Apr 2013 10:51:37 +0200
Jes Sorensen ec874c8
Subject: [PATCH] imsm: monitor: do not finish migration if there are no failed
Jes Sorensen ec874c8
 disks
Jes Sorensen ec874c8
Jes Sorensen ec874c8
Transition from "degraded" to "recovery" made in OROM is slightly different
Jes Sorensen ec874c8
than the same transision in mdadm. Missing disk is not removed from list of
Jes Sorensen ec874c8
raid devices, but just from map. Therefore mdadm should not end migration
Jes Sorensen ec874c8
basing on existence of list of missing disks but should rely on count of
Jes Sorensen ec874c8
failed disks.
Jes Sorensen ec874c8
Jes Sorensen ec874c8
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Jes Sorensen ec874c8
Tested-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Jes Sorensen ec874c8
Signed-off-by: NeilBrown <neilb@suse.de>
Jes Sorensen ec874c8
---
Jes Sorensen ec874c8
 super-intel.c | 9 ++++++++-
Jes Sorensen ec874c8
 1 file changed, 8 insertions(+), 1 deletion(-)
Jes Sorensen ec874c8
Jes Sorensen ec874c8
diff --git a/super-intel.c b/super-intel.c
Jes Sorensen ec874c8
index 24016b7..3f15b0f 100644
Jes Sorensen ec874c8
--- a/super-intel.c
Jes Sorensen ec874c8
+++ b/super-intel.c
Jes Sorensen ec874c8
@@ -6886,6 +6886,12 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
Jes Sorensen ec874c8
 	if (!super->missing)
Jes Sorensen ec874c8
 		return;
Jes Sorensen ec874c8
 
Jes Sorensen ec874c8
+	/* When orom adds replacement for missing disk it does
Jes Sorensen ec874c8
+	 * not remove entry of missing disk, but just updates map with
Jes Sorensen ec874c8
+	 * new added disk. So it is not enough just to test if there is
Jes Sorensen ec874c8
+	 * any missing disk, we have to look if there are any failed disks
Jes Sorensen ec874c8
+	 * in map to stop migration */
Jes Sorensen ec874c8
+
Jes Sorensen ec874c8
 	dprintf("imsm: mark missing\n");
Jes Sorensen ec874c8
 	/* end process for initialization and rebuild only
Jes Sorensen ec874c8
 	 */
Jes Sorensen ec874c8
@@ -6896,7 +6902,8 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
Jes Sorensen ec874c8
 		failed = imsm_count_failed(super, dev, MAP_0);
Jes Sorensen ec874c8
 		map_state = imsm_check_degraded(super, dev, failed, MAP_0);
Jes Sorensen ec874c8
 
Jes Sorensen ec874c8
-		end_migration(dev, super, map_state);
Jes Sorensen ec874c8
+		if (failed)
Jes Sorensen ec874c8
+			end_migration(dev, super, map_state);
Jes Sorensen ec874c8
 	}
Jes Sorensen ec874c8
 	for (dl = super->missing; dl; dl = dl->next)
Jes Sorensen ec874c8
 		mark_missing(dev, &dl->disk, dl->index);
Jes Sorensen ec874c8
-- 
Jes Sorensen ec874c8
1.8.1.4
Jes Sorensen ec874c8