From 7d0acdbcb026bf547dfb4ba5a0c8c45d66fc4f53 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 25 Feb 2025 00:28:33 +0100 Subject: [PATCH] thin: fix checking monitor mode Previous commit 874a8ab4d02a59c5 missed 'IGNORE' mode. Fix it by adding rather 'explicit' test for this value, so the code is better readable. Also unlock memory earlier and drop unneeded from return since we already logged error in this function. --- lib/metadata/thin_manip.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c index 3e725ab6c..4ea4c97e8 100644 --- a/lib/metadata/thin_manip.c +++ b/lib/metadata/thin_manip.c @@ -624,8 +624,8 @@ int update_thin_pool_lv(struct logical_volume *lv, int activate) if (activate) { /* If the pool is not active, do activate deactivate */ - monitored = (dmeventd_monitor_mode() == 1) ? 1 : 0; - init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE); + if (DMEVENTD_MONITOR_IGNORE != (monitored = dmeventd_monitor_mode())) + init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE); if (!lv_is_active(lv)) { /* * FIXME: @@ -660,6 +660,9 @@ int update_thin_pool_lv(struct logical_volume *lv, int activate) } } + /* Unlock memory if possible */ + memlock_unlock(lv->vg->cmd); + if (!sync_local_dev_names(lv->vg->cmd)) { log_error("Failed to sync local devices LV %s.", display_lvname(lv)); @@ -673,11 +676,8 @@ int update_thin_pool_lv(struct logical_volume *lv, int activate) } init_dmeventd_monitor(monitored); - /* Unlock memory if possible */ - memlock_unlock(lv->vg->cmd); - if (!ret) - return_0; + return 0; } dm_list_init(&(first_seg(lv)->thin_messages));