[lvm-devel] master - lvconvert: delay archiving of metadata

Zdenek Kabelac zkabelac at fedoraproject.org
Mon Mar 17 13:33:16 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b738260c7cdbc6094feda9f9e2426d50bd413263
Commit:        b738260c7cdbc6094feda9f9e2426d50bd413263
Parent:        d425e788e9ebaa2eef1fd747aec4dad03897114e
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Mon Mar 17 13:07:08 2014 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Mar 17 14:31:43 2014 +0100

lvconvert: delay archiving of metadata

Delay archiving of metadata until we really start to
update metadata when converting volume into a snapshot.
Archive is not necessary when we abort operation early.
---
 tools/lvconvert.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7f27dd4..4a26614 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2080,6 +2080,9 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
 		return 0;
 	}
 
+	if (!archive(lv->vg))
+		return_0;
+
 	if (!vg_add_snapshot(org, lv, NULL, org->le_count, lp->chunk_size)) {
 		log_error("Couldn't create snapshot.");
 		return 0;
@@ -3040,9 +3043,6 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
 			log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
 			return ECMD_FAILED;
 		}
-		if (!archive(lv->vg))
-			return_ECMD_FAILED;
-
 		if (!_lvconvert_snapshot(cmd, lv, lp))
 			return_ECMD_FAILED;
 




More information about the lvm-devel mailing list