summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2018-01-15 16:26:00 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2018-01-17 14:45:47 +0100
commita8bcdef4fd172b705572e3c0b277e6941be642f4 (patch)
tree0ec6ab3dea56fc4e270c9533633d83bfdfa11a60
parentf41935909fec9eb8d64bc04530be2f38866f0b8e (diff)
downloadlvm2-a8bcdef4fd172b705572e3c0b277e6941be642f4.tar.gz
activation: guard exclusive activation
Add protectional internall error whenever we spot activation of 'exclusive' only segments in 'non-exclusive' mode. TODO: possibly the activation locking could be enhanced to handle this fully behind the scene - as for now this works purely for lvchange/vgchange activation.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/activate/activate.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 00334b5e0..bc73cd775 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Avoid non-exclusive activation of exclusive segment types.
Fix trimming sibling PVs when doing a pvmove of raid subLVs.
Preserve exclusive activation during thin snaphost merge.
Suppress some repeated reads of the same disk data at the device layer.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 4c69af78d..b23400add 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2568,6 +2568,16 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
struct lvinfo info;
int r = 0;
+ if (!laopts->exclusive &&
+ (lv_is_origin(lv) ||
+ lv_is_pvmove(lv) ||
+ seg_only_exclusive(first_seg(lv)))) {
+ log_error(INTERNAL_ERROR "Trying non-exlusive activation of %s with "
+ "a volume type %s requiring exclusive activation.",
+ display_lvname(lv), lvseg_name(first_seg(lv)));
+ return 0;
+ }
+
if (!activation())
return 1;