1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

pvchange, pvresize: fix lockd_gl() usage

When an orphan PV is changed/resized, the
lvmlockd global lock is converted from sh
to ex. If the command is changing two
orphan PVs, the conversion to ex should
be done only once.
This commit is contained in:
David Teigland 2016-01-15 15:18:25 -06:00
parent 1ee6af344b
commit 54b41dcd53
2 changed files with 10 additions and 4 deletions

View File

@ -87,8 +87,11 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
* i.e. the global lock is only needed for orphans.
* Convert sh to ex.
*/
if (is_orphan(pv) && !lockd_gl(cmd, "ex", 0))
return_ECMD_FAILED;
if (is_orphan(pv)) {
if (!lockd_gl(cmd, "ex", 0))
return_ECMD_FAILED;
cmd->lockd_gl_disable = 1;
}
if (tagargs) {
/* tag or deltag */

View File

@ -41,8 +41,11 @@ static int _pvresize_single(struct cmd_context *cmd,
* i.e. the global lock is only needed for orphans.
* Convert sh to ex.
*/
if (is_orphan(pv) && !lockd_gl(cmd, "ex", 0))
return_ECMD_FAILED;
if (is_orphan(pv)) {
if (!lockd_gl(cmd, "ex", 0))
return_ECMD_FAILED;
cmd->lockd_gl_disable = 1;
}
if (!pv_resize_single(cmd, vg, pv, params->new_size))
return_ECMD_FAILED;