lvm2/0122-Fix-lvconvert-m-0-will-always-take-rimage_0-even-if-.patch
Marian Csontos 09f8953388 Additional patches for 8.10.0 lvm2
Resolves: RHEL-8289 RHEL-20192 RHEL-14216 RHEL-8298 RHEL-8334 RHEL-8270
2024-02-02 16:06:40 +01:00

49 lines
1.4 KiB
Diff

From 3b5e2537ae1ce6ee633b92f8df30602b9167044e Mon Sep 17 00:00:00 2001
From: heinzm <heinzm@redhat.com>
Date: Fri, 5 May 2023 15:00:49 +0200
Subject: [PATCH 05/12] Fix "lvconvert -m 0 will always take rimage_0 even if
it is out-of-sync"
Bail out in case first rimage is out-of-sync.
Refresh first, i.e. "lvchange --resync $RaidLV",
then retry downgrade to linear after resynchronization.
(cherry picked from commit d7e922480e04ecfb7c4d8b2d42533699ddef5c34)
---
lib/metadata/raid_manip.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0e6a77bac..5112989ab 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3112,14 +3112,23 @@ static int _raid_remove_images(struct logical_volume *lv, int yes,
{
struct dm_list removed_lvs;
- if (!archive(lv->vg))
- return_0;
+ if (new_count == 1) {
+ struct lv_segment *seg = first_seg(lv);
+
+ if (seg_is_raid1(seg) && !lv_raid_image_in_sync(seg_lv(seg, 0))) {
+ log_error("%s is out-of-sync! Please try refreshing first.", display_lvname(lv));
+ return 0;
+ }
+ }
if (!removal_lvs) {
dm_list_init(&removed_lvs);
removal_lvs = &removed_lvs;
}
+ if (!archive(lv->vg))
+ return_0;
+
if (!_raid_extract_images(lv, 0, new_count, allocate_pvs, 1,
removal_lvs, removal_lvs)) {
log_error("Failed to extract images from %s.",
--
2.43.0