summaryrefslogtreecommitdiff
path: root/tools/pvresize.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2009-06-26 10:55:57 +0000
committerAlasdair Kergon <agk@redhat.com>2009-06-26 10:55:57 +0000
commitf7c76e3878a6cd9ca5f06a7d9629492cb36ee73f (patch)
treee8fb554423f35ff41e53669ae01a6fe982cdfd77 /tools/pvresize.c
parent96d0004d12eef62a3b7d64a6ae2d02be84a885f8 (diff)
downloadlvm2-f7c76e3878a6cd9ca5f06a7d9629492cb36ee73f.tar.gz
revert last patch - let's do a release first
Diffstat (limited to 'tools/pvresize.c')
-rw-r--r--tools/pvresize.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/pvresize.c b/tools/pvresize.c
index 82c79368b..3b5f14930 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -29,6 +29,7 @@ static int _pv_resize_single(struct cmd_context *cmd,
const uint64_t new_size)
{
struct pv_list *pvl;
+ int consistent = 1;
uint64_t size = 0;
uint32_t new_pe_count = 0;
int r = 0;
@@ -58,9 +59,19 @@ static int _pv_resize_single(struct cmd_context *cmd,
} else {
vg_name = pv_vg_name(pv);
- vg = vg_read_for_update(cmd, vg_name, NULL, 0);
+ if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
+ log_error("Can't get lock for %s", pv_vg_name(pv));
+ return 0;
+ }
+
+ if (!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
+ unlock_vg(cmd, vg_name);
+ log_error("Unable to find volume group of \"%s\"",
+ pv_name);
+ return 0;
+ }
- if (vg_read_error(vg))
+ if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE))
goto bad;
if (!(pvl = find_pv_in_vg(vg, pv_name))) {