[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] LVM2 ./WHATS_NEW lib/metadata/merge.c lib/meta ...



CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk sourceware org	2007-11-07 16:33:12

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : merge.c snapshot_manip.c 
	tools          : lvconvert.c 

Log message:
	Prevent lvconvert -s from using same LV as origin and snapshot.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.729&r2=1.730
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/merge.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43

--- LVM2/WHATS_NEW	2007/11/05 17:17:55	1.729
+++ LVM2/WHATS_NEW	2007/11/07 16:33:11	1.730
@@ -1,5 +1,6 @@
 Version 2.02.29 -
 ==================================
+  Prevent lvconvert -s from using same LV as origin and snapshot.
   Fix human-readable output of odd numbers of sectors.
   Add pv_mda_free and vg_mda_free fields to reports for raw text format.
   Add LVM2 version to 'Generated by' comment in metadata.
--- LVM2/lib/metadata/merge.c	2007/08/20 20:55:26	1.29
+++ LVM2/lib/metadata/merge.c	2007/11/07 16:33:11	1.30
@@ -119,6 +119,15 @@
 			}
 		}
 
+		if (seg_is_snapshot(seg)) {
+			if (seg->cow && seg->cow == seg->origin) {
+				log_error("LV %s: segment %u has same LV %s for "
+					  "both origin and snapshot",
+					  lv->name, seg_count, seg->cow->name);
+				r = 0;
+			}
+		}
+
 		for (s = 0; s < seg->area_count; s++) {
 			if (seg_type(seg, s) == AREA_UNASSIGNED) {
 				log_error("LV %s: segment %u has unassigned "
--- LVM2/lib/metadata/snapshot_manip.c	2007/11/02 20:40:04	1.28
+++ LVM2/lib/metadata/snapshot_manip.c	2007/11/07 16:33:12	1.29
@@ -63,6 +63,11 @@
 		return 0;
 	}
 
+	if (cow == origin) {
+		log_error("Snapshot and origin LVs must differ.");
+		return 0;
+	}
+
 	if (!(snap = lv_create_empty(name ? name : "snapshot%d",
 				     lvid, LVM_READ | LVM_WRITE | VISIBLE_LV,
 				     ALLOC_INHERIT, 1, origin->vg))) {
--- LVM2/tools/lvconvert.c	2007/11/02 20:40:04	1.42
+++ LVM2/tools/lvconvert.c	2007/11/07 16:33:12	1.43
@@ -495,6 +495,12 @@
 		return 0;
 	}
 
+	if (org == lv) {
+		log_error("Unable to use \"%s\" as both snapshot and origin.",
+			  lv->name);
+		return 0;
+	}
+
 	if (org->status & (LOCKED|PVMOVE) || lv_is_cow(org)) {
 		log_error("Unable to create a snapshot of a %s LV.",
 			  org->status & LOCKED ? "locked" :


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]