mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
thin: new pool is activated without overlay
Activate of new/unused/empty thin pool volume skips the 'overlay' part and directly provides 'visible' thin-pool LV to the user. Such thin pool still gets 'private' -tpool UUID suffix for easier udev detection of protected lvm2 devices, and also gets udev flags to avoid any scan. Such pool device is 'public' LV with regular /dev/vgname/poolname link, but it's still 'udev' hidden device for any other use. To display proper active state we need to do few explicit tests for this condition. Before it's used for any lvm2 thin volume, deactivation is now needed to avoid any 'race' with external usage.
This commit is contained in:
parent
8563c3e1a9
commit
00a45ca491
@ -641,6 +641,10 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
|
||||
fs_unlock(); /* For non clustered - wait if there are non-delete ops */
|
||||
}
|
||||
|
||||
/* New thin-pool has no layer, but -tpool suffix needs to be queried */
|
||||
if (!use_layer && lv_is_new_thin_pool(lv))
|
||||
use_layer = 1;
|
||||
|
||||
if (!dev_manager_info(cmd->mem, lv,
|
||||
(use_layer) ? lv_layer(lv) : NULL,
|
||||
with_open_count, with_read_ahead,
|
||||
|
@ -1527,7 +1527,11 @@ static uint16_t _get_udev_flags(struct dev_manager *dm, const struct logical_vol
|
||||
* If not, create just the /dev/mapper content.
|
||||
*/
|
||||
/* FIXME: add target's method for this */
|
||||
if (layer || !lv_is_visible(lv) || lv_is_thin_pool(lv))
|
||||
if (lv_is_new_thin_pool(lv))
|
||||
/* New thin-pool is regular LV with -tpool UUID suffix. */
|
||||
udev_flags |= DM_UDEV_DISABLE_DISK_RULES_FLAG |
|
||||
DM_UDEV_DISABLE_OTHER_RULES_FLAG;
|
||||
else if (layer || !lv_is_visible(lv) || lv_is_thin_pool(lv))
|
||||
udev_flags |= DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG |
|
||||
DM_UDEV_DISABLE_DISK_RULES_FLAG |
|
||||
DM_UDEV_DISABLE_OTHER_RULES_FLAG;
|
||||
@ -2604,6 +2608,10 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
|
||||
if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
|
||||
return_0;
|
||||
|
||||
/* Even unused thin-pool still needs to get layered UUID -suffix */
|
||||
if (!layer && lv_is_new_thin_pool(lv))
|
||||
layer = lv_layer(lv);
|
||||
|
||||
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
|
||||
return_0;
|
||||
|
||||
@ -2679,8 +2687,9 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
|
||||
return_0;
|
||||
if (!_add_snapshot_target_to_dtree(dm, dnode, lv, laopts))
|
||||
return_0;
|
||||
} else if ((lv_is_external_origin(lv) || lv_is_thin_pool(lv)) && !layer) {
|
||||
/* External origin or Thin pool is using layer */
|
||||
} else if (!layer && ((lv_is_thin_pool(lv) && !lv_is_new_thin_pool(lv)) ||
|
||||
lv_is_external_origin(lv))) {
|
||||
/* External origin or 'used' Thin pool is using layer */
|
||||
if (!_add_new_lv_to_dtree(dm, dtree, lv, laopts, lv_layer(lv)))
|
||||
return_0;
|
||||
if (!_add_layer_target_to_dtree(dm, dnode, lv))
|
||||
|
Loading…
x
Reference in New Issue
Block a user