All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - raid: resync cannot lose primary leg
Date: Fri, 19 Mar 2021 23:17:10 +0000 (GMT)	[thread overview]
Message-ID: <20210319231710.00F38385783D@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cc140f68a505aad117a6e8222f65a5ea13139083
Commit:        cc140f68a505aad117a6e8222f65a5ea13139083
Parent:        076e1556978dfb216176d319d2498ec571fcc908
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Fri Mar 19 01:54:06 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Fri Mar 19 23:19:31 2021 +0100

raid: resync cannot lose primary leg

Prohibity droping primary leg while resyncing.
---
 lib/metadata/raid_manip.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index dc3bce201..33fd017cb 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2945,11 +2945,16 @@ static int _raid_allow_extraction(struct logical_volume *lv,
 	    !lv_raid_dev_health(lv, &dev_health))
 		return_0;
 
-	if (!strcmp("resync", sync_action))
-		return 1;
+	if (!strcmp("resync", sync_action)) {
+		if (!lv_is_on_pvs(seg_lv(seg, 0), target_pvs) &&
+		    !lv_is_on_pvs(seg_metalv(seg, 0), target_pvs))
+			return 1;
+		log_error("Unable to remove primary RAID image while array resyncing.");
+		return 0;
+	}
 
 	/* If anything other than "recover", rebuild or "idle" */
-        /* Targets reports for a while 'idle' state, before recover starts */
+	/* Targets reports for a while 'idle' state, before recover starts */
 	if (strcmp("recover", sync_action) &&
 	    strcmp("rebuild", sync_action) &&
 	    strcmp("idle", sync_action)) {



                 reply	other threads:[~2021-03-19 23:17 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=20210319231710.00F38385783D@sourceware.org \
    --to=zkabelac@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.