Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH] drbd: fix a bug with two-primaries configuration
@ 2022-07-28 11:47 Rui Xu
  2022-08-01 14:22 ` Joel Colledge
  0 siblings, 1 reply; 3+ messages in thread
From: Rui Xu @ 2022-07-28 11:47 UTC (permalink / raw)
  To: philipp.reisner, drbd-dev, joel.colledge; +Cc: Rui Xu, dongsheng.yang

There is a bug when execute 'drbdsetup disconnect' in
two-primaries configuration.

When 'drbdsetup disconnect' is called by user, two primary
nodes will going to outdated in do_change_cstate, then the
command will failed since there is no UpToDate node.

Fix it by modify the judgment condition in do_change_cstate.

Signed-off-by: Rui Xu <rui.xu@easystack.cn>
---
 drbd/drbd_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c
index 792a96d5..c4f3f776 100644
--- a/drbd/drbd_state.c
+++ b/drbd/drbd_state.c
@@ -5406,7 +5406,7 @@ static bool do_change_cstate(struct change_context *context, enum change_phase p
 		u64 directly_reachable = directly_connected_nodes(resource, NEW) |
 			NODE_MASK(resource->res_opts.node_id);
 
-		if (reply->primary_nodes & ~directly_reachable)
+		if (!(reply->primary_nodes & directly_reachable))
 			__outdate_myself(resource);
 	}
 
-- 
2.25.1


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

* Re: [Drbd-dev] [PATCH] drbd: fix a bug with two-primaries configuration
  2022-07-28 11:47 [Drbd-dev] [PATCH] drbd: fix a bug with two-primaries configuration Rui Xu
@ 2022-08-01 14:22 ` Joel Colledge
  2022-08-02  2:35   ` rui.xu
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Colledge @ 2022-08-01 14:22 UTC (permalink / raw)
  To: Rui Xu; +Cc: Philipp Reisner, dongsheng.yang, drbd-dev

The behavior that you describe is the intended behavior, I believe. If
you have two primaries and want to disconnect them in a controlled
fashion, you should demote them first.

As discussed previously, you probably should not be using
"allow-two-primaries" at all.

The proposed patch unfortunately also breaks various other usage
scenarios. For instance, if you have two nodes that are both Secondary
and UpToDate, and run 'drbdsetup disconnect', it will cause them to
become Outdated.

Best regards,
Joel

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

* Re: [Drbd-dev] [PATCH] drbd: fix a bug with two-primaries configuration
  2022-08-01 14:22 ` Joel Colledge
@ 2022-08-02  2:35   ` rui.xu
  0 siblings, 0 replies; 3+ messages in thread
From: rui.xu @ 2022-08-02  2:35 UTC (permalink / raw)
  To: Joel Colledge; +Cc: Philipp Reisner, dongsheng.yang, drbd-dev

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]

Hi Joel,
  Thanks for the reply. It is indeed a intended behavior and i will discard the patch.

Thanks,
Xu







From: Joel Colledge <joel.colledge@linbit.com>
Date: 2022-08-01 22:22:12
To:  Rui Xu <rui.xu@easystack.cn>
Cc:  Philipp Reisner <philipp.reisner@linbit.com>,drbd-dev@lists.linbit.com,dongsheng.yang@easystack.cn
Subject: Re: [PATCH] drbd: fix a bug with two-primaries configuration>The behavior that you describe is the intended behavior, I believe. If
>you have two primaries and want to disconnect them in a controlled
>fashion, you should demote them first.
>
>As discussed previously, you probably should not be using
>"allow-two-primaries" at all.
>
>The proposed patch unfortunately also breaks various other usage
>scenarios. For instance, if you have two nodes that are both Secondary
>and UpToDate, and run 'drbdsetup disconnect', it will cause them to
>become Outdated.
>
>Best regards,
>Joel





[-- Attachment #2: Type: text/html, Size: 1184 bytes --]

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

end of thread, other threads:[~2022-08-02  2:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28 11:47 [Drbd-dev] [PATCH] drbd: fix a bug with two-primaries configuration Rui Xu
2022-08-01 14:22 ` Joel Colledge
2022-08-02  2:35   ` rui.xu

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