diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-05-27 14:19:29 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-05-27 15:47:24 +0200 |
commit | 1c07e6746234e361ea68073b47a47df4bf4a7b2a (patch) | |
tree | 255edcdf6e30eb8a32c08057800a227ca633545b | |
parent | 0424277c00a8c576082389e0f4cdd8fd64052a54 (diff) | |
download | lvm2-1c07e6746234e361ea68073b47a47df4bf4a7b2a.tar.gz |
cache: enhance lv_cache_wait_for_clean
Handle passthrough mode when checking cache mode state explicitely.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/metadata/cache_manip.c | 27 |
2 files changed, 16 insertions, 12 deletions
@@ -1,5 +1,6 @@ Version 2.02.155 - ================================ + Support passthrough cache mode when waiting for clean cache. Check cache status only for 'in-use' cache pools. Extend setup_task() to preset flushing for dm_task object. When checking LV is a merging COW, validate its a COW LV first. diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c index a39549d5a..3e8c5c7bd 100644 --- a/lib/metadata/cache_manip.c +++ b/lib/metadata/cache_manip.c @@ -425,8 +425,11 @@ int lv_cache_remove(struct logical_volume *cache_lv) log_error("Cannot deactivate remotely active cache lv."); return 0; } - /* For inactive writethrough just drop cache layer */ - if (first_seg(cache_seg->pool_lv)->cache_mode == CACHE_MODE_WRITETHROUGH) { + + switch (first_seg(cache_seg->pool_lv)->cache_mode) { + case CACHE_MODE_WRITETHROUGH: + case CACHE_MODE_PASSTHROUGH: + /* For inactive pass/writethrough just drop cache layer */ corigin_lv = seg_lv(cache_seg, 0); if (!detach_pool_lv(cache_seg)) return_0; @@ -435,17 +438,17 @@ int lv_cache_remove(struct logical_volume *cache_lv) if (!lv_remove(corigin_lv)) return_0; return 1; + default: + /* Otherwise localy activate volume to sync dirty blocks */ + 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; } - - /* Otherwise localy active volume is need to sync dirty blocks */ - 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; } /* |