diff options
author | David Teigland <teigland@redhat.com> | 2016-01-15 15:18:25 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2016-01-18 09:35:06 -0600 |
commit | 54b41dcd53d99059b691f72eb6e7556d4341634d (patch) | |
tree | 9062ccf42797b3e602e6be6281fa08affe49c591 | |
parent | 1ee6af344bd805d4fa847b95b326c2fe1e52d7cd (diff) | |
download | lvm2-54b41dcd53d99059b691f72eb6e7556d4341634d.tar.gz |
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.
-rw-r--r-- | tools/pvchange.c | 7 | ||||
-rw-r--r-- | tools/pvresize.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/tools/pvchange.c b/tools/pvchange.c index 91e93c1e7..fad28d194 100644 --- a/tools/pvchange.c +++ b/tools/pvchange.c @@ -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 */ diff --git a/tools/pvresize.c b/tools/pvresize.c index 0b055e6ef..ad59bae2a 100644 --- a/tools/pvresize.c +++ b/tools/pvresize.c @@ -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; |