From 51031feb7fe287674dfbab96e539bf996b17582d Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Wed, 7 Aug 2024 17:04:12 +0200 Subject: [PATCH] Additional patch for 9.5.0 lvm2 Resolves: RHEL-8377 --- ...nreleased-memory-pool-s-message-on-R.patch | 60 +++++++++++++++++++ lvm2.spec | 6 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 0014-lv_manip-avoid-unreleased-memory-pool-s-message-on-R.patch diff --git a/0014-lv_manip-avoid-unreleased-memory-pool-s-message-on-R.patch b/0014-lv_manip-avoid-unreleased-memory-pool-s-message-on-R.patch new file mode 100644 index 0000000..be31103 --- /dev/null +++ b/0014-lv_manip-avoid-unreleased-memory-pool-s-message-on-R.patch @@ -0,0 +1,60 @@ +From a5672ff088a027af04dc5586926841a48b693ee0 Mon Sep 17 00:00:00 2001 +From: Heinz Mauelshagen +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 + diff --git a/lvm2.spec b/lvm2.spec index d246119..8a21a15 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -54,7 +54,7 @@ Version: 2.03.24 %if 0%{?from_snapshot} Release: 0.1.20211115git%{shortcommit}%{?dist}%{?rel_suffix} %else -Release: 1%{?dist}%{?rel_suffix} +Release: 2%{?dist}%{?rel_suffix} %endif License: GPLv2 URL: https://sourceware.org/lvm2 @@ -76,6 +76,7 @@ Patch10: 0010-vgimportdevices-skip-global-lockd-locking.patch Patch11: 0011-scripts-Install-services-for-devices-file-init.patch Patch12: 0012-lvmlockd-avoid-lockd_vg-for-local-VGs.patch Patch13: 0013-lvmlockd-allow-forced-vgchange-locktype-from-none.patch +Patch14: 0014-lv_manip-avoid-unreleased-memory-pool-s-message-on-R.patch BuildRequires: make BuildRequires: gcc @@ -706,6 +707,9 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Wed Aug 07 2024 Marian Csontos - 2.03.24-2 +- Fix unreleased memory pools on RAID's lvextend. + * Wed Jul 10 2024 Marian Csontos - 2.03.24-1 - Update to upstream version 2.03.24. - See WHATS_NEW and WHATS_NEW_DM for more information.