1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +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.

(cherry picked from commit 557b2850ce)
This commit is contained in:
Heinz Mauelshagen 2024-07-17 17:08:20 +02:00 committed by Marian Csontos
parent a6dec74334
commit a5672ff088
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Version 2.03.26 -
==================
Fix unreleased memory pools on RAID's lvextend.
Version 2.03.25 -
==================
Revert Don't import DM_UDEV_DISABLE_OTHER_RULES_FLAG in LVM rules, DM rules cover it.

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;
}