From e211768d1cb55cae01b010f073a8472836a283d0 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 24 May 2024 20:50:53 +0200 Subject: [PATCH] dev_manager: drop cache for dm tree manipulation We've got cached DM list before grabbing lock, so there is some chance, that DM table has changed and we would need to refresh this info. TODO: benchmark, whether it would even make sense to refresh cache and keep it content instead of using individual ioctl() for tree build. --- lib/activate/dev_manager.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 34fd49665..f4e47b531 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -3945,7 +3945,6 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv, struct dm_tree_node *root; char *dlid; int r = 0; - unsigned tmp_state; if (action < DM_ARRAY_SIZE(_action_names)) log_debug_activation("Creating %s%s tree for %s.", @@ -3964,14 +3963,11 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv, dm->activation = ((action == PRELOAD) || (action == ACTIVATE)); dm->suspend = (action == SUSPEND_WITH_LOCKFS) || (action == SUSPEND); - /* ATM do not use caching for anything else then striped target. - * And also skip for CLEAN action */ - tmp_state = dm->cmd->disable_dm_devs; - if (!seg_is_striped_target(first_seg(lv)) || (action == CLEAN)) - dm->cmd->disable_dm_devs = 1; + /* Drop any cache before DM table manipulation within locked section + * TODO: check if it makes sense to manage cache within lock */ + dm_device_list_destroy(&dm->cmd->cache_dm_devs); dtree = _create_partial_dtree(dm, lv, laopts->origin_only); - dm->cmd->disable_dm_devs = tmp_state; if (!dtree) return_0;