From da05bd7f7207eeab5fbd70b7a7c5166a9885e3b4 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 15 Jan 2018 16:26:00 +0100 Subject: [PATCH 18/25] 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. (cherry picked from commit a8bcdef4fd172b705572e3c0b277e6941be642f4) --- WHATS_NEW | 1 + lib/activate/activate.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 4368543..c3117de 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. Avoid exceeding array bounds in allocation tag processing. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 4c69af7..b23400a 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; -- 1.8.3.1