From a03c1494be1e00759c295e42c6b952807e8c579b Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Wed, 13 Nov 2024 16:22:18 +0100 Subject: [PATCH] Additional patches for 10.0.0 lvm2 Resolves: RHEL-67338 --- 0008-raid-fix-name-rotation.patch | 62 +++++++++++++++++++ ...sts-check-_tdata-conversion-to-raid1.patch | 28 +++++++++ 0010-WHATS_NEW-update.patch | 24 +++++++ lvm2.spec | 6 ++ 4 files changed, 120 insertions(+) create mode 100644 0008-raid-fix-name-rotation.patch create mode 100644 0009-tests-check-_tdata-conversion-to-raid1.patch create mode 100644 0010-WHATS_NEW-update.patch diff --git a/0008-raid-fix-name-rotation.patch b/0008-raid-fix-name-rotation.patch new file mode 100644 index 0000000..23b047b --- /dev/null +++ b/0008-raid-fix-name-rotation.patch @@ -0,0 +1,62 @@ +From 6e34a9e3959b659ac633d862af74c4c387a4d5ad Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +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 + diff --git a/0009-tests-check-_tdata-conversion-to-raid1.patch b/0009-tests-check-_tdata-conversion-to-raid1.patch new file mode 100644 index 0000000..38f044d --- /dev/null +++ b/0009-tests-check-_tdata-conversion-to-raid1.patch @@ -0,0 +1,28 @@ +From d6bdd28fca7fd770e6038a406ebb34b49ec54d5c Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +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 + diff --git a/0010-WHATS_NEW-update.patch b/0010-WHATS_NEW-update.patch new file mode 100644 index 0000000..7f71f11 --- /dev/null +++ b/0010-WHATS_NEW-update.patch @@ -0,0 +1,24 @@ +From babe041d8b75ab4b09714d7eadadc3175a9a4299 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +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 + diff --git a/lvm2.spec b/lvm2.spec index ca7db19..8a87deb 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -53,6 +53,9 @@ Patch4: 0004-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch Patch5: 0005-WHATS_NEW-update.patch Patch6: 0006-vdo-fix-input-units-for-minimim_io_size.patch Patch7: 0007-tests-check-vdo-minimum_io_size.patch +Patch8: 0008-raid-fix-name-rotation.patch +Patch9: 0009-tests-check-_tdata-conversion-to-raid1.patch +Patch10: 0010-WHATS_NEW-update.patch BuildRequires: make BuildRequires: gcc @@ -653,6 +656,9 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Thu Nov 14 2024 Marian Csontos - 2.03.28-3 +- Fix duplicate LV names when converting pools to RAID1 with more than 2 legs. + * Wed Nov 13 2024 Marian Csontos - 2.03.28-2 - Fix input units for VDO LV's minimim_io_size. - Fix stripe count and validation for RAID LVs.