Skip to contentSkip to conversation

LVM2 ./WHATS_NEW tools/lvcreate.c

PATCH [email protected] 1 participant 1 message Oct 26, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2006-10-26 18:22:10

Modified files:
. : WHATS_NEW
tools : lvcreate.c

Log message:
When adding snapshot leave cow LV mapped device active after zeroing.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.482&r2=1.483
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.128&r2=1.129

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.13 -
 ===================================
+  When adding snapshot leave cow LV mapped device active after zeroing.
   Fix a clvmd debug message.
   Add dev_flush() to set_lv().
   Add lvchange --resync.
tools/lvcreate.c +8 -9
@@ -761,13 +761,14 @@
 		return 0;
 	}
 
-	if (!activate_lv(cmd, lv)) {
-		if (lp->snapshot)
-			/* FIXME Remove the failed lv we just added */
+	if (lp->snapshot) {
+		if (!activate_lv_excl(cmd, lv)) {
 			log_error("Aborting. Failed to activate snapshot "
 				  "exception store. Remove new LV and retry.");
-		else
-			log_error("Failed to activate new LV.");
+			return 0;
+		}
+	} else if (!activate_lv(cmd, lv)) {
+		log_error("Failed to activate new LV.");
 		return 0;
 	}
 
@@ -787,10 +788,8 @@
 		/* Reset permission after zeroing */
 		if (!(lp->permission & LVM_WRITE))
 			lv->status &= ~LVM_WRITE;
-		if (!deactivate_lv(cmd, lv)) {
-			log_err("Couldn't deactivate new snapshot.");
-			return 0;
-		}
+
+		/* cow LV remains active and becomes snapshot LV */
 
 		if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL,
 				     org->le_count, lp->chunk_size)) {