All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] More fixes for virtual origin
Date: Wed, 27 May 2009 14:38:32 +0200	[thread overview]
Message-ID: <4A1D3448.4070102@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0905270759310.4445@hs20-bc2-1.build.redhat.com>

More fixes for virtual origin (applied over patch above)

 * try to load dm_zero using modprobe if not present

 * remove virtual origin from metadata if activate fails

 * fail if residual vorigin exist and do not create LV with duplicate name

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 lib/zero/zero.c  |    2 +-
 tools/lvcreate.c |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/zero/zero.c b/lib/zero/zero.c
index acf6453..7b3e62e 100644
--- a/lib/zero/zero.c
+++ b/lib/zero/zero.c
@@ -58,7 +58,7 @@ static int _zero_target_present(struct cmd_context *cmd,
 	static int _zero_present = 0;
 
 	if (!_zero_checked)
-		_zero_present = target_present(cmd, "zero", 0);
+		_zero_present = target_present(cmd, "zero", 1);
 
 	_zero_checked = 1;
 
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 8d4ec23..cfdd589 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -576,6 +576,12 @@ static struct logical_volume *_create_virtual_origin(struct cmd_context *cmd,
 		return 0;
 	}
 
+	if (find_lv_in_vg(vg, vorigin_name)) {
+		log_error("Virtual origin LV %s already exists in "
+			  "volume group %s.", vorigin_name, vg->name);
+		return 0;
+	}
+
 	if (!(lv = lv_create_empty(vorigin_name, NULL, permission,
 				   ALLOC_INHERIT, vg)))
 		return_0;
@@ -920,6 +926,8 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
 			if (!org || !activate_lv(cmd, org)) {
 				log_error("Couldn't create virtual origin "
 					  "for LV %s", lv->name);
+				if (org && !lv_remove(org))
+					stack;
 				goto deactivate_and_revert_new_lv;
 			}
 		}




      reply	other threads:[~2009-05-27 12:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 18:07 [PATCH] Fix handling of snapshots with virtual origin Milan Broz
2009-05-27 11:22 ` Mikulas Patocka
2009-05-27 11:30   ` Milan Broz
2009-05-27 12:01     ` Mikulas Patocka
2009-05-27 12:38       ` Milan Broz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A1D3448.4070102@redhat.com \
    --to=mbroz@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.