diff options
author | David Teigland <teigland@redhat.com> | 2018-06-11 15:08:23 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2018-06-12 09:46:11 -0500 |
commit | 9a8c36b8917edf00ea875e727b0b775ca5a87a43 (patch) | |
tree | f818f02fbc501d976bcb7782f12603c96d12af33 /tools/vgremove.c | |
parent | c4153a8dfca9defcea645818dcd547388858c51e (diff) | |
download | lvm2-9a8c36b8917edf00ea875e727b0b775ca5a87a43.tar.gz |
Fix use of orphan lock in commands
vgreduce, vgremove and vgcfgrestore were acquiring
the orphan lock in the midst of command processing
instead of at the start of the command. (The orphan
lock moved to being acquired at the start of the
command back when pvcreate/vgcreate/vgextend were
reworked based on pvcreate_each_device.)
vgsplit also needed a small update to avoid reacquiring
a VG lock that it already held (for the new VG name).
Diffstat (limited to 'tools/vgremove.c')
-rw-r--r-- | tools/vgremove.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/vgremove.c b/tools/vgremove.c index 8bf384151..5010e7d6b 100644 --- a/tools/vgremove.c +++ b/tools/vgremove.c @@ -108,10 +108,17 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv) */ cmd->lockd_gl_disable = 1; + if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) { + log_error("Can't get lock for orphan PVs"); + return ECMD_FAILED; + } + cmd->handles_missing_pvs = 1; ret = process_each_vg(cmd, argc, argv, NULL, NULL, READ_FOR_UPDATE, 0, NULL, &_vgremove_single); + unlock_vg(cmd, NULL, VG_ORPHANS); + return ret; } |