From ee37838b1149f3f8d5c34dc2d459421f8e085bbb Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 8 Mar 2018 10:30:46 +0100 Subject: [PATCH] cache: fix lock usage for cache conversion Just like with lvcreate, this lvconvert case also need to properly check which LV actually holds lock for cached origin - as it might be i.e. thin-pool tdata subLV. --- lib/metadata/lv_manip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index bde2a005f..9566f3e4a 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -7384,6 +7384,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct logical_volume *lv, *origin_lv = NULL; struct logical_volume *pool_lv = NULL; struct logical_volume *tmp_lv; + const struct logical_volume *lock_lv; struct lv_segment *seg, *pool_seg; int thin_pool_was_active = -1; /* not scanned, inactive, active */ int historical; @@ -7547,11 +7548,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, } /* Validate cache origin is exclusively active */ + lock_lv = lv_lock_holder(origin_lv); if (vg_is_clustered(origin_lv->vg) && locking_is_clustered() && locking_supports_remote_queries() && - lv_is_active(origin_lv) && - !lv_is_active_exclusive(origin_lv)) { + lv_is_active(lock_lv) && + !lv_is_active_exclusive(lock_lv)) { log_error("Cannot cache not exclusively active origin volume %s.", display_lvname(origin_lv)); return NULL;