All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinz Mauelshagen <heinzm@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - Fix "lvconvert -m 0 will always take rimage_0 even if it is out-of-sync"
Date: Fri,  5 May 2023 18:54:02 +0000 (GMT)	[thread overview]
Message-ID: <20230505185402.CD1013858D33@sourceware.org> (raw)

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


                 reply	other threads:[~2023-05-05 18:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230505185402.CD1013858D33@sourceware.org \
    --to=heinzm@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.