Blob Blame History Raw
From e3e7ea0c384da84ccd38406482ec1877c6b19d8a Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 17 Jan 2018 15:15:43 +0100
Subject: [PATCH 25/25] activation: move check later

Check for lv when it's known in all cases.

(cherry picked from commit f3c75bb2014e9ae7d212e0c016a94c529ac8a912)
---
 lib/activate/activate.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index b23400a..18cc7cf 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2568,6 +2568,12 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
 	struct lvinfo info;
 	int r = 0;
 
+	if (!activation())
+		return 1;
+
+	if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0)))
+		goto out;
+
 	if (!laopts->exclusive &&
 	    (lv_is_origin(lv) ||
 	     lv_is_pvmove(lv) ||
@@ -2578,12 +2584,6 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
 		return 0;
 	}
 
-	if (!activation())
-		return 1;
-
-	if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0)))
-		goto out;
-
 	if (filter && !_passes_activation_filter(cmd, lv)) {
 		log_verbose("Not activating %s since it does not pass "
 			    "activation filter.", display_lvname(lv));
-- 
1.8.3.1