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

dev_manager: no layer suffix for component

Do not attach layer suffix to the UUID when activating component LV.

In this case we want to see allow this LV to be public, thus
such LV should not be using -layer suffix in its UUID.

This also requires that our 'cached' access will check for
both UUID (with & without suffix) which was unnoticed issue before.

This change is now necesssary since our udev rule automatically expects
any LV with -layer suffix is private and will prevent generaring
any systemd unit even when there are no 'DM' flags bits passed via
cookie mechanism while creating such LV.
This commit is contained in:
Zdenek Kabelac 2024-06-21 11:08:30 +02:00
parent b1d80a0ffd
commit 14f782c5a7

View File

@ -1053,6 +1053,7 @@ int dev_manager_info(struct cmd_context *cmd,
struct dm_info *dminfo, uint32_t *read_ahead,
struct lv_seg_status *seg_status)
{
char old_style_dlid[sizeof(UUID_PREFIX) + 2 * ID_LEN];
char *dlid, *name;
int r = 0;
@ -1062,8 +1063,11 @@ int dev_manager_info(struct cmd_context *cmd,
if (!(dlid = build_dm_uuid(cmd->mem, lv, layer)))
goto_out;
dm_strncpy(old_style_dlid, dlid, sizeof(old_style_dlid));
if (cmd->cache_dm_devs &&
!dm_device_list_find_by_uuid(cmd->cache_dm_devs, dlid, NULL)) {
!dm_device_list_find_by_uuid(cmd->cache_dm_devs, dlid, NULL) &&
!dm_device_list_find_by_uuid(cmd->cache_dm_devs, old_style_dlid, NULL)) {
log_debug("Cached as inactive %s.", name);
if (dminfo)
memset(dminfo, 0, sizeof(*dminfo));
@ -3633,7 +3637,11 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!layer && lv_is_writecache_origin(lv))
layer = lv_layer(lv); /* "real" */
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
if (lvlayer->visible_component) {
/* Component LV will be public, do not add any layer suffixes */
if (!(dlid = dm_build_dm_uuid(dm->mem, UUID_PREFIX, lv->lvid.s, NULL)))
return_0;
} else if (!(dlid = build_dm_uuid(dm->mem, lv,layer)))
return_0;
/* We've already processed this node if it already has a context ptr */