From b37203c8193ea47d2de1033b5e57ae5bd1360df4 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 3 Oct 2014 23:48:42 +0200 Subject: [PATCH] cache: check activation of volume activated volume_list may silently skip activation which is then still reported as success. --- WHATS_NEW | 1 + lib/metadata/cache_manip.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index a11fa16e4..275d6660b 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.112 - ===================================== + Properly check if activation of removed cached LV really activated. Lvremoving cached LV removes cachepool (keep with lvconvert --splitcache). Always remove spare LV with last removed pool volume. Support lvconvert --splitcache and --uncache of cached LV. diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c index 80214c9b7..ed0872668 100644 --- a/lib/metadata/cache_manip.c +++ b/lib/metadata/cache_manip.c @@ -229,11 +229,16 @@ int lv_cache_remove(struct logical_volume *cache_lv) return 0; } - /* Active volume is needed (writeback only?) */ - if (!lv_is_active_locally(cache_lv) && - !activate_lv_excl_local(cache_lv->vg->cmd, cache_lv)) { - log_error("Failed to active cache locally %s.", cache_lv->name); - return 0; + /* Localy active volume is needed (writeback only?) */ + if (!lv_is_active_locally(cache_lv)) { + cache_lv->status |= LV_TEMPORARY; + if (!activate_lv_excl_local(cache_lv->vg->cmd, cache_lv) || + !lv_is_active_locally(cache_lv)) { + log_error("Failed to active cache locally %s.", + display_lvname(cache_lv)); + return 0; + } + cache_lv->status &= ~LV_TEMPORARY; } /*