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

lv_manip: avoid unreleased memory pool(s) message on RAID extend

In case of different PV sizes in a VG, the lvm2 allocator falls short
to define extended segments resiliently asked for 100%FREE RaidLV extension
and a RAID distinct allocation check fails.  Fix is to release a memory pool
on the resulting error path.

Until the lvm2 allocator gets enhanced (WIP) to do such complex (and other)
allocations proper, a workaround is to extend a RaidLV to any free space on
its already allocated PVs by defining those PVs on the lvextend command line
then iteratively run further such lvextend commands to extend it to its
final intended size.  Mind, this may be a non-trivial extension interation.
This commit is contained in:
Heinz Mauelshagen 2024-07-17 17:08:20 +02:00
parent c288ddd6c8
commit 557b2850ce

View File

@ -4415,6 +4415,7 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
log_error("Failed to remove LV");
else if (!vg_write(vg) || !vg_commit(vg))
log_error("Failed to commit VG %s", vg->name);
dm_pool_free(vg->vgmem, lvl);
return_0;
}
@ -4571,7 +4572,7 @@ int lv_extend(struct logical_volume *lv,
alloc != ALLOC_ANYWHERE &&
!(r = _lv_raid_redundant_allocation(lv, allocatable_pvs))) {
log_error("Insufficient suitable allocatable extents for logical volume %s", display_lvname(lv));
if (!lv_remove(lv) || !vg_write(lv->vg) || !vg_commit(lv->vg))
if (!old_extents && (!lv_remove(lv) || !vg_write(lv->vg) || !vg_commit(lv->vg)))
return_0;
goto out;
}