Additional patches for 9.6.0 lvm2

Resolves: RHEL-67229
This commit is contained in:
Marian Csontos 2024-11-13 15:50:50 +01:00
parent e2fd3d1ba8
commit d244296759
4 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From 2bc2dad1e2c7019dd33b1081d69e0cee4040d566 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Nov 2024 12:52:18 +0100
Subject: [PATCH 1/3] raid: fix name rotation
Since we now keep lv names valid all the time (as they are part
of radix_tree) - there is a problem with this renaming code, that
for a moment used duplicated name in vg struct.
Fix it by interating LVs backwared - which avoids breaking consitency
and also actually makes code more simple.
(cherry picked from commit c2f41c1a59351772b78f2328edd61f996cc37c3b)
---
lib/metadata/raid_manip.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 60ae897ef..8abad8be7 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2637,6 +2637,7 @@ static int _raid_add_images_without_commit(struct logical_volume *lv,
struct lv_list *lvl;
struct lv_segment_area *new_areas;
struct segment_type *segtype;
+ const char *lv_name, *lv_name_tmp;
if (lv_is_not_synced(lv)) {
log_error("Can't add image to out-of-sync RAID LV:"
@@ -2704,22 +2705,14 @@ static int _raid_add_images_without_commit(struct logical_volume *lv,
* commits the LVM metadata before clearing the LVs.
*/
if (seg_is_linear(seg)) {
- struct dm_list *l;
- struct lv_list *lvl_tmp;
- const char *lv_name;
-
- dm_list_iterate(l, &data_lvs) {
- if (l == dm_list_last(&data_lvs)) {
- lvl = dm_list_item(l, struct lv_list);
- if (!(lv_name = _generate_raid_name(lv, "rimage", count)) ||
- !lv_set_name(lvl->lv, lv_name))
- return_0;
- continue;
- }
- lvl = dm_list_item(l, struct lv_list);
- lvl_tmp = dm_list_item(l->n, struct lv_list);
- if (!lv_set_name(lvl->lv, lvl_tmp->lv->name))
+ if (!(lv_name = _generate_raid_name(lv, "rimage", count)))
+ return_0;
+
+ dm_list_iterate_back_items(lvl, &data_lvs) {
+ lv_name_tmp = lvl->lv->name;
+ if (!lv_set_name(lvl->lv, lv_name))
return_0;
+ lv_name = lv_name_tmp; /* rotate name in list */
}
}
--
2.47.0

View File

@ -0,0 +1,28 @@
From bdcd4f18fe03f6c3fca94e27e5469b1409dda3ad Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Nov 2024 12:59:27 +0100
Subject: [PATCH 2/3] tests: check _tdata conversion to raid1
(cherry picked from commit 7b9bdcb4d4aef7f0a079e2278869f19aa7fb7c83)
---
test/shell/lvconvert-thin-raid.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/test/shell/lvconvert-thin-raid.sh b/test/shell/lvconvert-thin-raid.sh
index c021e3b77..7b0e4a5c9 100644
--- a/test/shell/lvconvert-thin-raid.sh
+++ b/test/shell/lvconvert-thin-raid.sh
@@ -58,4 +58,10 @@ lvconvert --merge $vg/${lv1}_tmeta_rimage_1
lvconvert -y -m +1 $vg/${lv1}_tdata "$dev2"
lvconvert -y -m +1 $vg/${lv1}_tmeta "$dev1"
+lvremove -f $vg
+
+lvcreate -L10M -T $vg/pool
+lvconvert -y --type raid1 -m2 $vg/pool_tdata
+lvconvert -y --type raid1 -m2 $vg/pool_tmeta
+
vgremove -ff $vg
--
2.47.0

View File

@ -0,0 +1,24 @@
From cce339d487194e3a27b7386a2e463416fb96b9f1 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 13 Nov 2024 13:06:15 +0100
Subject: [PATCH 3/3] WHATS_NEW: update
(cherry picked from commit 473e93fbfff513f849e76eba919c44aa07608c30)
---
WHATS_NEW | 1 +
1 file changed, 1 insertion(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index d07a1eaeb..bea47f154 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.29 -
==================
+ Fix renaming of raid sub LVs when converting a volume to raid (2.03.28).
Fix segfault/VG write error for raid LV lvextend -i|--stripes -I|--stripesize.
Revert ignore -i|--stripes, -I|--stripesize for lvextend on raid0 LV (2.03.27).
--
2.47.0

View File

@ -54,7 +54,7 @@ Version: 2.03.28
%if 0%{?from_snapshot}
Release: 0.1.20211115git%{shortcommit}%{?dist}%{?rel_suffix}
%else
Release: 2%{?dist}%{?rel_suffix}
Release: 3%{?dist}%{?rel_suffix}
%endif
License: GPL-2.0-only
URL: https://sourceware.org/lvm2
@ -76,6 +76,9 @@ Patch10: 0010-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch
Patch11: 0011-WHATS_NEW-update.patch
Patch12: 0012-vdo-fix-input-units-for-minimim_io_size.patch
Patch13: 0013-tests-check-vdo-minimum_io_size.patch
Patch14: 0014-raid-fix-name-rotation.patch
Patch15: 0015-tests-check-_tdata-conversion-to-raid1.patch
Patch16: 0016-WHATS_NEW-update.patch
BuildRequires: make
BuildRequires: gcc
@ -706,6 +709,9 @@ An extensive functional testsuite for LVM2.
%endif
%changelog
* Thu Nov 14 2024 Marian Csontos <mcsontos@redhat.com> - 2.03.28-3
- Fix duplicate LV names when converting pools to RAID1 with more than 2 legs.
* Wed Nov 13 2024 Marian Csontos <mcsontos@redhat.com> - 2.03.28-2
- Fix SPDX License identifiers.
- Fix input units for VDO LV's minimim_io_size.