Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Rui Xu <rui.xu@easystack.cn>
To: philipp.reisner@linbit.com, joel.colledge@linbit.com,
	drbd-dev@lists.linbit.com
Cc: Rui Xu <rui.xu@easystack.cn>, dongsheng.yang@easystack.cn
Subject: [Drbd-dev] [PATCH] drbd:clear NEW_CUR_UUID when uuid was actually created
Date: Mon, 11 Apr 2022 20:02:04 +0800	[thread overview]
Message-ID: <20220411120204.3683999-1-rui.xu@easystack.cn> (raw)

If there is an IO blocked by creating new uuid, but we found
we dont have quorum, then NEW_CUR_UUID will be cleared but
new uuid was not actually created.

After one peer online, we have enough quorum to continue IO, then this
IO will reach  primary and the online peer.

But if there is another peer join later, this peer will found same uuid, and will lose data.

So don't clear NEW_CUR_UUID unless uuid was actually created.

Signed-off-by: Rui Xu <rui.xu@easystack.cn>
---
 drbd/drbd_sender.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c
index 7238730..b0e3701 100644
--- a/drbd/drbd_sender.c
+++ b/drbd/drbd_sender.c
@@ -2360,15 +2360,17 @@ void drbd_check_peers_new_current_uuid(struct drbd_device *device)
 
 	drbd_check_peers(resource);
 
-	if (device->have_quorum[NOW] && drbd_data_accessible(device, NOW))
+	if (device->have_quorum[NOW] && drbd_data_accessible(device, NOW)) {
 		drbd_uuid_new_current(device, false);
+		clear_bit(NEW_CUR_UUID, &device->flags);
+	}
 }
 
 static void make_new_current_uuid(struct drbd_device *device)
 {
 	drbd_check_peers_new_current_uuid(device);
 
-	get_work_bits(1UL << NEW_CUR_UUID | 1UL << WRITING_NEW_CUR_UUID, &device->flags);
+	clear_bit(WRITING_NEW_CUR_UUID, &device->flags);
 	wake_up(&device->misc_wait);
 }
 
-- 
1.8.3.1


             reply	other threads:[~2022-04-11 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 12:02 Rui Xu [this message]
2022-04-11 15:21 ` [Drbd-dev] [PATCH] drbd:clear NEW_CUR_UUID when uuid was actually created Joel Colledge

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=20220411120204.3683999-1-rui.xu@easystack.cn \
    --to=rui.xu@easystack.cn \
    --cc=dongsheng.yang@easystack.cn \
    --cc=drbd-dev@lists.linbit.com \
    --cc=joel.colledge@linbit.com \
    --cc=philipp.reisner@linbit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox