Skip to contentSkip to conversation

master - activation: Fix segfault with inactive pvmove LV.

PATCH Alasdair Kergon 1 participant 1 message Aug 28, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c0f987949b8a0bbbbe7f06694f59f710a73814da
Commit:        c0f987949b8a0bbbbe7f06694f59f710a73814da
Parent:        0acd7173d14195aeb724c1048a8cbf64a2fd2aa7
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Wed Aug 28 22:56:23 2013 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Wed Aug 28 22:56:23 2013 +0100

activation: Fix segfault with inactive pvmove LV.

Set flag to avoid recursion back through an inactive pvmove LV when populating deptree.

---
 WHATS_NEW                  |    3 ++-
 lib/activate/dev_manager.c |    8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
WHATS_NEW +2 -1
index d974b0a..71e9fa8 100644
@@ -1,6 +1,7 @@
 Version 2.02.101 - 
 ===================================
-  Require exactly 3 arguments for lvm2-activation-generator, remove defaults.
+  Avoid unlimited recursion when creating dtree containing inactive pvmove LV.
+  Require exactly 3 arguments for lvm2-activation-generator. Remove defaults.
   Disable pvmove of merging or converting logical volumes.
   Enable pvmove of snapshots and snapshot origins.
   Fix inability to specify LV name when pvmove'ing a RAID, mirror, or thin-LV.
lib/activate/dev_manager.c +5 -3
index 294606c..11be421 100644
@@ -1763,11 +1763,13 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
 				return_0;
 
 	/* Add any LVs referencing a PVMOVE LV unless told not to. */
-	if (dm->track_pvmove_deps && lv->status & PVMOVE)
+	if (dm->track_pvmove_deps && lv->status & PVMOVE) {
+		dm->track_pvmove_deps = 0;
 		dm_list_iterate_items(sl, &lv->segs_using_this_lv)
-			if (!_cached_info(dm->mem, dtree, sl->seg->lv, 0) &&
-			    !_add_lv_to_dtree(dm, dtree, sl->seg->lv, origin_only))
+			if (!_add_lv_to_dtree(dm, dtree, sl->seg->lv, origin_only))
 				return_0;
+		dm->track_pvmove_deps = 1;
+	}
 
 	/* Adding LV head of replicator adds all other related devs */
 	if (lv_is_replicator_dev(lv) &&