All of lore.kernel.org
 help / color / mirror / Atom feed
* master - cleanup: relocate error capture
@ 2015-11-09  9:28 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2015-11-09  9:28 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0c380c316c51920db5b5721863cb1b55bfa9acf1
Commit:        0c380c316c51920db5b5721863cb1b55bfa9acf1
Parent:        67b4761bc3c53ee67a1fbe33f41757a6563db5cb
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Wed Nov 4 14:53:25 2015 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Nov 9 10:21:09 2015 +0100

cleanup: relocate error capture

Capture internal error before allocation anything.
---
 lib/metadata/lv_manip.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index e23a8b9..c9cc6b5 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3165,6 +3165,12 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
 	else
 		area_count = stripes;
 
+	if (!segtype_is_virtual(segtype) &&
+	    !(area_count + metadata_area_count)) {
+		log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
+		return NULL;
+	}
+
 	size = sizeof(*ah);
 
 	/*
@@ -3203,11 +3209,6 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
 	if (segtype_is_virtual(segtype))
 		return ah;
 
-	if (!(area_count + metadata_area_count)) {
-		log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
-		return NULL;
-	}
-
 	if (!(ah->mem = dm_pool_create("allocation", 1024))) {
 		log_error("allocation pool creation failed");
 		return NULL;



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-09  9:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09  9:28 master - cleanup: relocate error capture Zdenek Kabelac

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.