All of lore.kernel.org
 help / color / mirror / Atom feed
* main - Fix "lvconvert -m 0 will always take rimage_0 even if it is out-of-sync"
@ 2023-05-05 18:54 Heinz Mauelshagen
  0 siblings, 0 replies; only message in thread
From: Heinz Mauelshagen @ 2023-05-05 18:54 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d7e922480e04ecfb7c4d8b2d42533699ddef5c34
Commit:        d7e922480e04ecfb7c4d8b2d42533699ddef5c34
Parent:        368381fd4022dc99ffe551b30ed75c3ddbc5c5c8
Author:        heinzm <heinzm@redhat.com>
AuthorDate:    Fri May 5 15:00:49 2023 +0200
Committer:     heinzm <heinzm@redhat.com>
CommitterDate: Fri May 5 20:51:58 2023 +0200

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.
---
 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.",


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-05 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 18:54 main - Fix "lvconvert -m 0 will always take rimage_0 even if it is out-of-sync" Heinz Mauelshagen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.