From 75a5de1462c30f364c7d478a4f74f355ce559ae9 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 15 Sep 2014 13:42:43 +0200 Subject: [PATCH] thin: check for active lv Before calling deactivate, check the lv is actually active, as we may reach this 'bad' error path with pool_lv inactive. --- WHATS_NEW | 1 + lib/metadata/pool_manip.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index ac9d9a506..c48b979a1 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.112 - ===================================== + Avoid leaving linear logical volume when thin pool creation fails. Demote an error to a warning when devices known to lvmetad are filtered out. Re-order filter evaluation, making component filters global. Don't leak alloc_handle on raid target error path. diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c index 0ed5d642c..0c66c77d5 100644 --- a/lib/metadata/pool_manip.c +++ b/lib/metadata/pool_manip.c @@ -450,7 +450,8 @@ int create_pool(struct logical_volume *pool_lv, bad: if (activation()) { - if (deactivate_lv_local(pool_lv->vg->cmd, pool_lv)) { + if (lv_is_active_locally(pool_lv) && + deactivate_lv_local(pool_lv->vg->cmd, pool_lv)) { log_error("Aborting. Could not deactivate pool %s.", pool_lv->name); return 0; -- 2.43.5