1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Update lvm_vg_extend() to obtain VG_ORPHAN.

vg_extend() no longer obtains VG_OPHAN so we must do so in liblvm function.
We still have the race in liblvm but we will address this problem later.
This commit is contained in:
Dave Wysochanski 2009-07-24 15:12:50 +00:00
parent e6923120b9
commit 0b7cc76a9d

View File

@ -40,11 +40,23 @@ vg_t *lvm_vg_create(lvm_t libh, const char *vg_name)
int lvm_vg_extend(vg_t *vg, const char *device)
{
if (vg_read_error(vg))
goto_bad;
return 0;
return vg_extend(vg, 1, (char **) &device);
bad:
return 0;
if (!lock_vol(vg->cmd, VG_ORPHANS, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return 0;
}
if (!vg_extend(vg, 1, (char **) &device)) {
unlock_vg(vg->cmd, VG_ORPHANS);
return 0;
}
/*
* FIXME: Either commit to disk, or keep holding VG_ORPHANS and
* release in lvm_vg_close().
*/
unlock_vg(vg->cmd, VG_ORPHANS);
return 1;
}
int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size)