Blame SOURCES/lvm2-2_02_178-activation-guard-exclusive-activation.patch

f0aa83
From da05bd7f7207eeab5fbd70b7a7c5166a9885e3b4 Mon Sep 17 00:00:00 2001
f0aa83
From: Zdenek Kabelac <zkabelac@redhat.com>
f0aa83
Date: Mon, 15 Jan 2018 16:26:00 +0100
f0aa83
Subject: [PATCH 18/25] activation: guard exclusive activation
f0aa83
f0aa83
Add protectional internall error whenever we spot activation
f0aa83
of 'exclusive' only segments in 'non-exclusive' mode.
f0aa83
f0aa83
TODO: possibly the activation locking could be enhanced to handle
f0aa83
this fully behind the scene - as for now this works purely for
f0aa83
lvchange/vgchange activation.
f0aa83
f0aa83
(cherry picked from commit a8bcdef4fd172b705572e3c0b277e6941be642f4)
f0aa83
---
f0aa83
 WHATS_NEW               |  1 +
f0aa83
 lib/activate/activate.c | 10 ++++++++++
f0aa83
 2 files changed, 11 insertions(+)
f0aa83
f0aa83
diff --git a/WHATS_NEW b/WHATS_NEW
f0aa83
index 4368543..c3117de 100644
f0aa83
--- a/WHATS_NEW
f0aa83
+++ b/WHATS_NEW
f0aa83
@@ -1,5 +1,6 @@
f0aa83
 Version 2.02.178 - 
f0aa83
 =====================================
f0aa83
+  Avoid non-exclusive activation of exclusive segment types.
f0aa83
   Fix trimming sibling PVs when doing a pvmove of raid subLVs.
f0aa83
   Preserve exclusive activation during thin snaphost merge.
f0aa83
   Avoid exceeding array bounds in allocation tag processing.
f0aa83
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
f0aa83
index 4c69af7..b23400a 100644
f0aa83
--- a/lib/activate/activate.c
f0aa83
+++ b/lib/activate/activate.c
f0aa83
@@ -2568,6 +2568,16 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
f0aa83
 	struct lvinfo info;
f0aa83
 	int r = 0;
f0aa83
 
f0aa83
+	if (!laopts->exclusive &&
f0aa83
+	    (lv_is_origin(lv) ||
f0aa83
+	     lv_is_pvmove(lv) ||
f0aa83
+	     seg_only_exclusive(first_seg(lv))))  {
f0aa83
+		log_error(INTERNAL_ERROR "Trying non-exlusive activation of %s with "
f0aa83
+			  "a volume type %s requiring exclusive activation.",
f0aa83
+			  display_lvname(lv), lvseg_name(first_seg(lv)));
f0aa83
+		return 0;
f0aa83
+	}
f0aa83
+
f0aa83
 	if (!activation())
f0aa83
 		return 1;
f0aa83
 
f0aa83
-- 
f0aa83
1.8.3.1
f0aa83