Skip to contentSkip to conversation

master - Revert "lvconvert: fix (automatic) raid repair regression"

PATCH Alasdair Kergon 1 participant 1 message Sep 21, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c2f65806f62a49f6f3da59e721f7a1d03326c009
Commit:        c2f65806f62a49f6f3da59e721f7a1d03326c009
Parent:        094488ffab4837fa14069b81a15e0a6bdaca8a73
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Wed Sep 21 16:05:08 2016 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Wed Sep 21 16:05:08 2016 +0100

Revert "lvconvert: fix (automatic) raid repair regression"

This reverts commit 5d455b28fce16fce20f33279fe3b1b682c57e619.

This change depends on the kernel version, so should detect this and behave accordingly.

---
 WHATS_NEW                                     |    1 -
 daemons/dmeventd/plugins/raid/dmeventd_raid.c |   42 ++--------
 lib/metadata/lv.c                             |    6 ++
 lib/metadata/raid_manip.c                     |    2 +-
 test/shell/lvconvert-repair-raid.sh           |  104 +-----------------------
 tools/lvconvert.c                             |   18 ++++
 6 files changed, 39 insertions(+), 134 deletions(-)
WHATS_NEW +0 -1
index f7b39b9..faddb9f 100644
@@ -1,6 +1,5 @@
 Version 2.02.166 - 
 =====================================
-  Fix lvconvert --repair regression
   Fix reported origin lv field for cache volumes. (2.02.133)
   Always specify snapshot cow LV for monitoring not internal LV. (2.02.165)
   Fix lvchange --discard|--zero for active thin-pool.
daemons/dmeventd/plugins/raid/dmeventd_raid.c +9 -33

87 lines not on this page · raw message

lib/metadata/lv.c +6 -0
index 70036f9..03d52ae 100644
@@ -1017,6 +1017,12 @@ int lv_raid_image_in_sync(const struct logical_volume *lv)
 		return 0;
 	}
 
+	if (!lv_raid_percent(raid_seg->lv, &percent))
+		return_0;
+
+	if (percent == DM_PERCENT_100)
+		return 1;
+
 	/* Find out which sub-LV this is. */
 	for (s = 0; s < raid_seg->area_count; s++)
 		if (seg_lv(raid_seg, s) == lv)
lib/metadata/raid_manip.c +1 -1
index deb88a2..e5fdf4f 100644
@@ -3658,7 +3658,7 @@ static int _lv_raid_rebuild_or_replace(struct logical_volume *lv,
 		return 0;
 	}
 
-	if (!_raid_in_sync(lv)) {
+	if (!mirror_in_sync() && !_raid_in_sync(lv)) {
 		log_error("Unable to replace devices in %s/%s while it is"
 			  " not in-sync.", lv->vg->name, lv->name);
 		return 0;
test/shell/lvconvert-repair-raid.sh +5 -99

126 lines not on this page · raw message

tools/lvconvert.c +18 -0
index 3607247..18010d5 100644
@@ -1973,6 +1973,24 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
 			return 0;
 		}
 
+		if (!lv_raid_percent(lv, &sync_percent)) {
+			log_error("Unable to determine sync status of %s.",
+				  display_lvname(lv));
+			return 0;
+		}
+
+		if (sync_percent != DM_PERCENT_100) {
+			log_warn("WARNING: %s is not in-sync.", display_lvname(lv));
+			log_warn("WARNING: Portions of the array may be unrecoverable.");
+
+			/*
+			 * The kernel will not allow a device to be replaced
+			 * in an array that is not in-sync unless we override
+			 * by forcing the array to be considered "in-sync".
+			 */
+			init_mirror_in_sync(1);
+		}
+
 		_lvconvert_raid_repair_ask(cmd, lp, &replace);
 
 		if (replace) {