mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
lvconvert: hanle metadataswap with lvmlockd
This commit is contained in:
parent
fdf2571679
commit
b3e45219c2
@ -2918,6 +2918,24 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If LV is inactive here, ensure it's not active elsewhere. */
|
||||||
|
if (!lockd_lv(cmd, lv, "ex", 0))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!deactivate_lv(cmd, metadata_lv)) {
|
||||||
|
log_error("Aborting. Failed to deactivate %s.",
|
||||||
|
display_lvname(metadata_lv));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lockd_lv(cmd, metadata_lv, "un", 0)) {
|
||||||
|
log_error("Failed to unlock LV %s.", display_lvname(metadata_lv));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata_lv->lock_args = NULL;
|
||||||
|
|
||||||
|
|
||||||
seg = first_seg(lv);
|
seg = first_seg(lv);
|
||||||
|
|
||||||
/* Normally do NOT change chunk size when swapping */
|
/* Normally do NOT change chunk size when swapping */
|
||||||
@ -2959,12 +2977,6 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deactivate_lv(cmd, metadata_lv)) {
|
|
||||||
log_error("Aborting. Failed to deactivate %s.",
|
|
||||||
display_lvname(metadata_lv));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Swap names between old and new metadata LV */
|
/* Swap names between old and new metadata LV */
|
||||||
|
|
||||||
if (!detach_pool_metadata_lv(seg, &prev_metadata_lv))
|
if (!detach_pool_metadata_lv(seg, &prev_metadata_lv))
|
||||||
@ -4768,19 +4780,13 @@ int lvconvert_to_thin_with_data_cmd(struct cmd_context *cmd, int argc, char **ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _lvconvert_swap_pool_metadata_single(struct cmd_context *cmd,
|
static int _lvconvert_swap_pool_metadata_single(struct cmd_context *cmd,
|
||||||
struct logical_volume *lv,
|
struct logical_volume *lv,
|
||||||
struct processing_handle *handle)
|
struct processing_handle *handle)
|
||||||
{
|
{
|
||||||
struct volume_group *vg = lv->vg;
|
struct volume_group *vg = lv->vg;
|
||||||
struct logical_volume *metadata_lv;
|
struct logical_volume *metadata_lv;
|
||||||
const char *metadata_name;
|
const char *metadata_name;
|
||||||
|
|
||||||
if (vg_is_shared(lv->vg)) {
|
|
||||||
/* FIXME: need to swap locks betwen LVs? */
|
|
||||||
log_error("Unable to swap pool metadata in VG with lock_type %s", lv->vg->lock_type);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(metadata_name = arg_str_value(cmd, poolmetadata_ARG, NULL)))
|
if (!(metadata_name = arg_str_value(cmd, poolmetadata_ARG, NULL)))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user