From: "zhengbing.huang" <zhengbing.huang@easystack.cn>
To: drbd-dev@lists.linbit.com
Cc: philipp.reisner@linbit.com
Subject: [Drbd-dev] [PATCH] drbd: when change susp_uuid[NEW] to true, make sure susp_uuid[OLD] is false
Date: Wed, 22 Nov 2023 11:25:10 +0800 [thread overview]
Message-ID: <20231122032510.24233-1-zhengbing.huang@easystack.cn> (raw)
The problem scenario is as follows:
1. drbd is built on two nodes, role is primary and secondary, quorum is 2.
then drbd's network fails. IO will be suspended.
2. primary modify quorum to 1, during this state change,
drbd will set susp_uuid[NEW] to true and generate a new UUID.
3. then in w_after_state_change, start the second state change,
set susp_uuid[NEW] to false. but during the second state change,
it's possible to find NEW_CUR_UUID flag was set by others.
then sanitize_state() will set susp_uuid[NEW] to true.
Finally susp_uuid value is {true, true}, IO is frozen.
And there is no way to set susp_uuid to false after that.
So, while susp_uuid[NEW] is set to true, we want susp_uuid[OLD] to be false.
Fixes: d47f7456ab ("drbd: create new UUID before resuming IO upon regaining quorum")
Signed-off-by: zhengbing.huang <zhengbing.huang@easystack.cn>
---
drbd/drbd_state.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c
index e35150340..0dedd2dae 100644
--- a/drbd/drbd_state.c
+++ b/drbd/drbd_state.c
@@ -2356,6 +2356,7 @@ static void sanitize_state(struct drbd_resource *resource)
if (resource_is_suspended(resource, OLD) && !resource_is_suspended(resource, NEW)) {
idr_for_each_entry(&resource->devices, device, vnr) {
if (test_bit(NEW_CUR_UUID, &device->flags)) {
+ resource->susp_uuid[OLD] = false;
resource->susp_uuid[NEW] = true;
break;
}
--
2.17.1
next reply other threads:[~2023-11-22 3:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 3:25 zhengbing.huang [this message]
2023-11-23 6:06 ` [Drbd-dev] [PATCH] drbd: when change susp_uuid[NEW] to true, make sure susp_uuid[OLD] is false Philipp Reisner
[not found] ` <AD6A8wCfJHnR*HQ37T48hqrF.2.1700729326235.Hmail.zhengbing.huang@easystack.cn>
2023-11-25 7:47 ` Philipp Reisner
2023-11-27 6:48 ` 黄正兵
2023-12-07 5:35 ` Philipp Reisner
2023-12-07 13:14 ` 黄正兵
2023-12-08 8:17 ` Philipp Reisner
2023-12-08 9:27 ` Zhengbing
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=20231122032510.24233-1-zhengbing.huang@easystack.cn \
--to=zhengbing.huang@easystack.cn \
--cc=drbd-dev@lists.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