public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 lib/metadata/lv_manip.c ./WHATS_NEW
@ 2012-05-11 22:53 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2012-05-11 22:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2012-05-11 22:53:13

Modified files:
	lib/metadata   : lv_manip.c 
	.              : WHATS_NEW 

Log message:
	Fix cling policy not to behave like normal policy if no previous LV seg.
	Fix alloc cling to cling to PVs already found with contiguous policy.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.379&r2=1.380
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2403&r2=1.2404

--- LVM2/lib/metadata/lv_manip.c	2012/05/11 22:19:12	1.379
+++ LVM2/lib/metadata/lv_manip.c	2012/05/11 22:53:13	1.380
@@ -910,13 +910,18 @@
 	if (alloc_parms->prev_lvseg) {
 		if (alloc_parms->alloc == ALLOC_CONTIGUOUS)
 			alloc_parms->flags |= A_CONTIGUOUS_TO_LVSEG;
-		else if (alloc_parms->alloc == ALLOC_CLING)
+		else if ((alloc_parms->alloc == ALLOC_CLING) || (alloc_parms->alloc == ALLOC_CLING_BY_TAGS))
 			alloc_parms->flags |= A_CLING_TO_LVSEG;
-		else if (alloc_parms->alloc == ALLOC_CLING_BY_TAGS) {
-			alloc_parms->flags |= A_CLING_TO_LVSEG;
-			alloc_parms->flags |= A_CLING_BY_TAGS;
-		}
-	}
+	} else
+		/*
+		 * A cling allocation that follows a successful contiguous allocation
+		 * must use the same PVs (or else fail).
+		 */
+		if ((alloc_parms->alloc == ALLOC_CLING) || (alloc_parms->alloc == ALLOC_CLING_BY_TAGS))
+			alloc_parms->flags |= A_CLING_TO_ALLOCED;
+
+	if (alloc_parms->alloc == ALLOC_CLING_BY_TAGS)
+		alloc_parms->flags |= A_CLING_BY_TAGS;
 
 	/*
 	 * For normal allocations, if any extents have already been found 
@@ -1435,7 +1440,8 @@
 /*
  * Is pva on same PV as any areas already used in this allocation attempt?
  */
-static int _check_cling_to_alloced(struct alloc_handle *ah, struct pv_area *pva, struct alloc_state *alloc_state)
+static int _check_cling_to_alloced(struct alloc_handle *ah, const struct dm_config_node *cling_tag_list_cn,
+				   struct pv_area *pva, struct alloc_state *alloc_state)
 {
 	unsigned s;
 	struct alloced_area *aa;
@@ -1451,7 +1457,8 @@
 		if (alloc_state->areas[s].pva)
 			continue;	/* Area already assigned */
 		dm_list_iterate_items(aa, &ah->alloced_areas[s]) {
-			if (pva->map->pv == aa[0].pv) {
+			if ((!cling_tag_list_cn && (pva->map->pv == aa[0].pv)) ||
+			    (cling_tag_list_cn && _pvs_have_matching_tag(cling_tag_list_cn, pva->map->pv, aa[0].pv))) {
 				_reserve_area(&alloc_state->areas[s], pva, pva->count, s + 1, 0);
 				return 1;
 			}
@@ -1505,29 +1512,28 @@
 		/* Try next area on same PV if looking for contiguous space */
 		if (alloc_parms->flags & A_CONTIGUOUS_TO_LVSEG)
 			return NEXT_AREA;
-	
-		/* Cling_to_alloced? */
-		if ((alloc_parms->flags & A_CLING_TO_ALLOCED) &&
-		    _check_cling_to_alloced(ah, pva, alloc_state))
-			return PREFERRED;
 
-		/* Cling? */
-		if (!(alloc_parms->flags & A_CLING_BY_TAGS) &&
-		    alloc_parms->prev_lvseg && _check_cling(ah, NULL, alloc_parms->prev_lvseg, pva, alloc_state))
+		/* Cling to prev_lvseg? */
+		if (((alloc_parms->flags & A_CLING_TO_LVSEG) || (ah->maximise_cling && alloc_parms->prev_lvseg)) &&
+		    _check_cling(ah, NULL, alloc_parms->prev_lvseg, pva, alloc_state))
 			/* If this PV is suitable, use this first area */
 			return PREFERRED;
 
-		if (!ah->maximise_cling && !(alloc_parms->flags & A_CLING_BY_TAGS))
-			return NEXT_PV;
+		/* Cling_to_alloced? */
+		if ((alloc_parms->flags & A_CLING_TO_ALLOCED) &&
+		    _check_cling_to_alloced(ah, NULL, pva, alloc_state))
+			return PREFERRED;
 
 		/* Cling_by_tags? */
-		if ((alloc_parms->flags & (A_CLING_BY_TAGS | A_CLING_TO_ALLOCED)) && ah->cling_tag_list_cn &&
-		    alloc_parms->prev_lvseg && _check_cling(ah, ah->cling_tag_list_cn, alloc_parms->prev_lvseg, pva, alloc_state))
-			return PREFERRED;
-	
-		if (alloc_parms->flags & A_CLING_BY_TAGS)
+		if (!(alloc_parms->flags & A_CLING_BY_TAGS) || !ah->cling_tag_list_cn)
 			return NEXT_PV;
 
+		if (alloc_parms->prev_lvseg) {
+			if (_check_cling(ah, ah->cling_tag_list_cn, alloc_parms->prev_lvseg, pva, alloc_state))
+				return PREFERRED;
+		} else if (_check_cling_to_alloced(ah, ah->cling_tag_list_cn, pva, alloc_state))
+			return PREFERRED;
+
 		/* All areas on this PV give same result so pointless checking more */
 		return NEXT_PV;
 	}
@@ -1669,6 +1675,7 @@
 	uint32_t devices_needed = ah->area_count + ah->parity_count;
 
 	/* ix_offset holds the number of parallel allocations that must be contiguous/cling */
+	/* At most one of A_CONTIGUOUS_TO_LVSEG, A_CLING_TO_LVSEG or A_CLING_TO_ALLOCED may be set */
 	if (alloc_parms->flags & (A_CONTIGUOUS_TO_LVSEG | A_CLING_TO_LVSEG))
 		ix_offset = _stripes_per_mimage(alloc_parms->prev_lvseg) * alloc_parms->prev_lvseg->area_count;
 
@@ -1791,7 +1798,7 @@
 				break;
 		}
 	} while ((alloc_parms->alloc == ALLOC_ANYWHERE && last_ix != ix && ix < devices_needed + alloc_state->log_area_count_still_needed) ||
-		/* With cling_to_alloced, if there were gaps in the preferred areas, have a second iteration */
+		/* With cling_to_alloced and normal, if there were gaps in the preferred areas, have a second iteration */
 		 (alloc_parms->alloc == ALLOC_NORMAL && preferred_count &&
 		  (preferred_count < ix_offset || alloc_state->log_area_count_still_needed) &&
 		  (alloc_parms->flags & A_CLING_TO_ALLOCED) && !iteration_count++) ||
@@ -1920,7 +1927,7 @@
 			return_0;
 
 		/*
-		 * If we didn't allocate anything this time and had
+		 * If we didn't allocate anything this time with ALLOC_NORMAL and had
 		 * A_CLING_TO_ALLOCED set, try again without it.
 		 *
 		 * For ALLOC_NORMAL, if we did allocate something without the
@@ -1928,7 +1935,7 @@
 		 * remain on the same disks where possible.
 		 */
 		if (old_allocated == alloc_state->allocated) {
-			if (alloc_parms->flags & A_CLING_TO_ALLOCED)
+			if ((alloc_parms->alloc == ALLOC_NORMAL) && (alloc_parms->flags & A_CLING_TO_ALLOCED))
 				alloc_parms->flags &= ~A_CLING_TO_ALLOCED;
 			else
 				break;	/* Give up */
--- LVM2/WHATS_NEW	2012/05/11 22:19:12	1.2403
+++ LVM2/WHATS_NEW	2012/05/11 22:53:13	1.2404
@@ -1,6 +1,8 @@
 Version 2.02.96 - 
 ================================
-  Fix policy loop not to use later policies when --alloc cling without tags.
+  Fix alloc cling to cling to PVs already found with contiguous policy.
+  Fix cling policy not to behave like normal policy if no previous LV seg.
+  Fix allocation loop not to use later policies when --alloc cling without tags.
   Append _TO_LVSEG to names of internal A_CONTIGUOUS and A_CLING flags.
   Add missing pkg init --with-systemdsystemunitdir in configure.in (2.02.92).
   Fix division by zero if PV with zero PE count is used during vgcfgrestore.


^ permalink raw reply	[flat|nested] 3+ messages in thread
* LVM2 lib/metadata/lv_manip.c ./WHATS_NEW
@ 2012-05-14 16:19 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2012-05-14 16:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2012-05-14 16:18:58

Modified files:
	lib/metadata   : lv_manip.c 
	.              : WHATS_NEW 

Log message:
	Warn of deadlock risk when using snapshots of mirror segment type.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.380&r2=1.381
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2404&r2=1.2405

--- LVM2/lib/metadata/lv_manip.c	2012/05/11 22:53:13	1.380
+++ LVM2/lib/metadata/lv_manip.c	2012/05/14 16:18:57	1.381
@@ -4231,9 +4231,9 @@
 
 			if (lv_is_mirror_type(org) &&
 			    !seg_is_raid(first_seg(org))) {
-				log_error("Snapshots of \"mirror\" segment types"
-					  " are not supported");
-				return NULL;
+				log_warn("WARNING: Snapshots of mirrors can deadlock under rare device failures.");
+				log_warn("WARNING: Consider using the raid1 mirror type to avoid this.");
+				log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
 			}
 
 			if (!lv_info(cmd, org, 0, &info, 0, 0)) {
--- LVM2/WHATS_NEW	2012/05/11 22:53:13	1.2404
+++ LVM2/WHATS_NEW	2012/05/14 16:18:58	1.2405
@@ -9,7 +9,7 @@
   Add initial support for thin pool lvconvert.
   Fix lvrename for thin volumes (regression in for_each_sub_lv() 2.02.89).
   Fix up-convert when mirror activation is controled by volume_list and tags.
-  Disallow snapshots of mirror segment type.
+  Warn of deadlock risk when using snapshots of mirror segment type.
   Fix bug in cmirror that caused incorrect status info to print on some nodes.
   Remove statement that snapshots cannot be tagged from lvm man page.
   Disallow changing cluster attribute of VG while RAID LVs are active.


^ permalink raw reply	[flat|nested] 3+ messages in thread
* LVM2 lib/metadata/lv_manip.c ./WHATS_NEW
@ 2011-11-04  1:31 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2011-11-04  1:31 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-11-04 01:31:24

Modified files:
	lib/metadata   : lv_manip.c 
	.              : WHATS_NEW 

Log message:
	Add missing lvrename mirrored log recursion in for_each_sub_lv.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.319&r2=1.320
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2176&r2=1.2177

--- LVM2/lib/metadata/lv_manip.c	2011/11/03 15:46:51	1.319
+++ LVM2/lib/metadata/lv_manip.c	2011/11/04 01:31:23	1.320
@@ -2749,13 +2749,20 @@
 	struct lv_segment *seg;
 	uint32_t s;
 
-	if (lv_is_cow(lv) && lv_is_virtual_origin(org = origin_from_cow(lv)))
+	if (lv_is_cow(lv) && lv_is_virtual_origin(org = origin_from_cow(lv))) {
 		if (!fn(cmd, org, data))
 			return_0;
+		if (!for_each_sub_lv(cmd, org, fn, data))
+			return_0;
+	}
 
 	dm_list_iterate_items(seg, &lv->segments) {
-		if (seg->log_lv && !fn(cmd, seg->log_lv, data))
-			return_0;
+		if (seg->log_lv) {
+			if (!fn(cmd, seg->log_lv, data))
+				return_0;
+			if (!for_each_sub_lv(cmd, seg->log_lv, fn, data))
+				return_0;
+		}
 		if (seg->pool_metadata_lv && !fn(cmd, seg->pool_metadata_lv, data))
 			return_0;
 		for (s = 0; s < seg->area_count; s++) {
--- LVM2/WHATS_NEW	2011/10/28 20:23:24	1.2176
+++ LVM2/WHATS_NEW	2011/11/04 01:31:23	1.2177
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Add missing lvrename mirrored log recursion in for_each_sub_lv.
   Improve lv_extend stack reporting.
   Increase virtual segment size instead of creating multiple segment list.
   Add last_seg(lv) internal function.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-14 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-11 22:53 LVM2 lib/metadata/lv_manip.c ./WHATS_NEW agk
  -- strict thread matches above, loose matches on Subject: below --
2012-05-14 16:19 agk
2011-11-04  1:31 agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).