[Drbd-dev] [PATCH] drbd: fix a bug with two-primaries configuration

Rui Xu rui.xu at easystack.cn
Thu Jul 28 13:47:59 CEST 2022


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 at 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



More information about the drbd-dev mailing list