Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH] drbd: when change susp_uuid[NEW] to true, make sure susp_uuid[OLD] is false
@ 2023-11-22  3:25 zhengbing.huang
  2023-11-23  6:06 ` Philipp Reisner
  0 siblings, 1 reply; 8+ messages in thread
From: zhengbing.huang @ 2023-11-22  3:25 UTC (permalink / raw)
  To: drbd-dev; +Cc: philipp.reisner

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-08  9:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22  3:25 [Drbd-dev] [PATCH] drbd: when change susp_uuid[NEW] to true, make sure susp_uuid[OLD] is false zhengbing.huang
2023-11-23  6:06 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox