1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

pvmove: enhance delayed_resume logic

ATM we want to support delayed resume purely in pvmove case.
So have libdm logic internal to recognize difference beween
pvmove and other targets that do use delayed resume.

This fixes problem introduced with commit aa68b898ff
for mirror-on-mirror or snapshot-on-mirror problem.

TODO: likely added new API call and let libdm user select
delayed nodes explicitely.
This commit is contained in:
Zdenek Kabelac 2017-11-26 00:28:33 +01:00
parent 8c6fd0933f
commit f70404addb
2 changed files with 5 additions and 4 deletions

View File

@ -303,7 +303,7 @@ static int _add_log(struct dm_pool *mem, struct lv_segment *seg,
} }
} else { } else {
/* If core log, use mirror's UUID and set DM_CORELOG flag */ /* If core log, use mirror's UUID and set DM_CORELOG flag */
if (!(log_dlid = build_dm_uuid(mem, seg->lv, NULL))) { if (!(log_dlid = build_dm_uuid(mem, seg->lv, lv_is_pvmove(seg->lv) ? "pvmove" : NULL))) {
log_error("Failed to build uuid for mirror LV %s.", log_error("Failed to build uuid for mirror LV %s.",
seg->lv->name); seg->lv->name);
return 0; return 0;

View File

@ -2963,8 +2963,8 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
/* Preload children first */ /* Preload children first */
while ((child = dm_tree_next_child(&handle, dnode, 0))) { while ((child = dm_tree_next_child(&handle, dnode, 0))) {
/* Propagate delay of resume from parent node */ /* Propagate delay of resume from parent node */
if (dnode->props.delay_resume_if_new) if (dnode->props.delay_resume_if_new > 1)
child->props.delay_resume_if_new = 1; child->props.delay_resume_if_new = dnode->props.delay_resume_if_new;
/* Skip existing non-device-mapper devices */ /* Skip existing non-device-mapper devices */
if (!child->info.exists && child->info.major) if (!child->info.exists && child->info.major)
@ -3342,7 +3342,8 @@ int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node,
} }
if ((flags & DM_CORELOG)) if ((flags & DM_CORELOG))
/* For pvmove: immediate resume (for size validation) isn't needed. */ /* For pvmove: immediate resume (for size validation) isn't needed. */
node->props.delay_resume_if_new = 1; /* pvmove flag passed via unused UUID and its suffix */
node->props.delay_resume_if_new = strstr(log_uuid, "pvmove") ? 2 : 1;
else { else {
if (!(log_node = dm_tree_find_node_by_uuid(node->dtree, log_uuid))) { if (!(log_node = dm_tree_find_node_by_uuid(node->dtree, log_uuid))) {
log_error("Couldn't find mirror log uuid %s.", log_uuid); log_error("Couldn't find mirror log uuid %s.", log_uuid);