mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +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:
parent
e6923120b9
commit
0b7cc76a9d
@ -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)
|
int lvm_vg_extend(vg_t *vg, const char *device)
|
||||||
{
|
{
|
||||||
if (vg_read_error(vg))
|
if (vg_read_error(vg))
|
||||||
goto_bad;
|
|
||||||
|
|
||||||
return vg_extend(vg, 1, (char **) &device);
|
|
||||||
bad:
|
|
||||||
return 0;
|
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)
|
int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size)
|
||||||
|
Loading…
Reference in New Issue
Block a user