diff options
Diffstat (limited to 'tools/vgremove.c')
-rw-r--r-- | tools/vgremove.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/vgremove.c b/tools/vgremove.c index cd5d0400..2d29a4d9 100644 --- a/tools/vgremove.c +++ b/tools/vgremove.c @@ -24,7 +24,19 @@ static int vgremove_single(const char *vg_name); int vgremove(int argc, char **argv) { - return process_each_vg(argc, argv, &vgremove_single); + int ret; + + if (!lock_vol("", LCK_VG | LCK_WRITE)) { + log_error("Can't get lock for orphan PVs"); + return ECMD_FAILED; + } + + ret = process_each_vg(argc, argv, LCK_WRITE | LCK_NONBLOCK, + &vgremove_single); + + lock_vol("", LCK_VG | LCK_NONE); + + return ret; } static int vgremove_single(const char *vg_name) |