From eefcbd5b28aae6c0bed22a6ff8cb97141184083f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 19 Feb 2016 11:18:41 +0100 Subject: [PATCH] thin: fix update_pool_lv error path When update fails in suspend() (sending of messages fails because metadata space is full) call resume(), so the locking sequence works properly for clustering. Also failing deactivation should unlock memory. --- WHATS_NEW | 1 + lib/metadata/thin_manip.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 8d9294b3f..654f0a13f 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.143 - ===================================== + Fix error path when sending thin-pool message fails in update_pool_lv(). Support reporting CheckNeeded and Fail state for thin-pool and thin LV. For failing thin-pool and thin volume correctly report percentage as INVALID. Report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary. diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c index 288625977..de3c7e8f2 100644 --- a/lib/metadata/thin_manip.c +++ b/lib/metadata/thin_manip.c @@ -469,16 +469,22 @@ int update_pool_lv(struct logical_volume *lv, int activate) if (!(ret = _check_pool_create(lv))) stack; /* Safety guard, needs local presence of thin-pool target */ - else if (!(ret = suspend_lv_origin(lv->vg->cmd, lv))) - /* Send messages */ - log_error("Failed to suspend and send message %s.", display_lvname(lv)); - else if (!(ret = resume_lv_origin(lv->vg->cmd, lv))) - log_error("Failed to resume %s.", display_lvname(lv)); + else { + if (!(ret = suspend_lv_origin(lv->vg->cmd, lv))) + /* Send messages */ + log_error("Failed to suspend %s with queued messages.", display_lvname(lv)); + + /* Even failing suspend needs resume */ + if (!resume_lv_origin(lv->vg->cmd, lv)) { + log_error("Failed to resume %s.", display_lvname(lv)); + ret = 0; + } + } if (activate) { if (!deactivate_lv(lv->vg->cmd, lv)) { - init_dmeventd_monitor(monitored); - return_0; + log_error("Failed to deactivate %s.", display_lvname(lv)); + ret = 0; } init_dmeventd_monitor(monitored); }