1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

lvmlockd: fix missing LV lock for lvconvert repair

Add missing lvmlockd LV lock for lvconvert repair
on mirror and thin/cache pools.
This commit is contained in:
David Teigland 2018-12-07 13:11:31 -06:00
parent 8d107f9a20
commit fc091143b6

View File

@ -3448,6 +3448,18 @@ static int _lvconvert_repair_pvs_mirror(struct cmd_context *cmd, struct logical_
struct lvinfo info;
int ret;
/*
* We want to allow cmirror active on multiple nodes to be repaired,
* but normal mirror to only be repaired if active exclusively here.
* If the LV is active it already has the necessary lock, but if not
* active, then require ex since we cannot know the active state on
* other hosts.
*/
if (!lv_is_active(lv)) {
if (!lockd_lv(cmd, lv, "ex", 0))
return_0;
}
/*
* FIXME: temporary use of lp because _lvconvert_mirrors_repair()
* and _aux() still use lp fields everywhere.
@ -3578,6 +3590,10 @@ static int _lvconvert_repair_cachepool_thinpool(struct cmd_context *cmd, struct
int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE);
struct dm_list *use_pvh;
/* ensure it's not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
return_0;
if (cmd->position_argc > 1) {
/* First pos arg is required LV, remaining are optional PVs. */
if (!(use_pvh = create_pv_list(cmd->mem, lv->vg, cmd->position_argc - 1, cmd->position_argv + 1, 0)))