1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2024-05-24 20:50:53 +02:00
parent d192477ae6
commit e211768d1c

View File

@ -3945,7 +3945,6 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
struct dm_tree_node *root; struct dm_tree_node *root;
char *dlid; char *dlid;
int r = 0; int r = 0;
unsigned tmp_state;
if (action < DM_ARRAY_SIZE(_action_names)) if (action < DM_ARRAY_SIZE(_action_names))
log_debug_activation("Creating %s%s tree for %s.", 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->activation = ((action == PRELOAD) || (action == ACTIVATE));
dm->suspend = (action == SUSPEND_WITH_LOCKFS) || (action == SUSPEND); dm->suspend = (action == SUSPEND_WITH_LOCKFS) || (action == SUSPEND);
/* ATM do not use caching for anything else then striped target. /* Drop any cache before DM table manipulation within locked section
* And also skip for CLEAN action */ * TODO: check if it makes sense to manage cache within lock */
tmp_state = dm->cmd->disable_dm_devs; dm_device_list_destroy(&dm->cmd->cache_dm_devs);
if (!seg_is_striped_target(first_seg(lv)) || (action == CLEAN))
dm->cmd->disable_dm_devs = 1;
dtree = _create_partial_dtree(dm, lv, laopts->origin_only); dtree = _create_partial_dtree(dm, lv, laopts->origin_only);
dm->cmd->disable_dm_devs = tmp_state;
if (!dtree) if (!dtree)
return_0; return_0;