lvm2/SOURCES/0014-lv_manip-avoid-unreleased-memory-pool-s-message-on-R.patch

61 lines
2.3 KiB
Diff
Raw Permalink Normal View History

2024-09-30 16:03:40 +00:00
From a5672ff088a027af04dc5586926841a48b693ee0 Mon Sep 17 00:00:00 2001
From: Heinz Mauelshagen <heinzm@redhat.com>
Date: Wed, 17 Jul 2024 17:08:20 +0200
Subject: [PATCH 14/14] 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 557b2850cef7fa49e2cbacd36e77f679181f09ae)
---
WHATS_NEW | 5 +++++
lib/metadata/lv_manip.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1d56f8675..8647a8f87 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index bec363ef8..871d3bec9 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -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;
}
--
2.45.2