[Drbd-dev] [PATCH] drbd: Ignore negotiation result with the peer who is also negotiating

Zhang Duan duan.zhang at easystack.cn
Mon Mar 2 13:31:59 CET 2020

We have a test on 3 nodes cluster in which the primary is uptodate and 
the other two secondary
is diskless by doing drbdadm detach. Then after doing drbdadm attach on 
the two secondary at
the same time, one status hangs at NEGOTIATING while another hangs at 

That is because if a negotiating peer receives another's 
wide-cluster-change from DISKLESS to
NEGOTIATING, it will reject it due to more than one negotiation 
throughout the cluster, but the
new disk state of that node remains NEGOTIATING after a failed state 
change. Then neither of
two peers can get a negotiating result what they want.

Signed-off-by: ZhangDuan
drbd/drbd_state.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c
index c919d759..85910f1e 100644
--- a/drbd/drbd_state.c
+++ b/drbd/drbd_state.c
@@ -1835,8 +1835,10 @@ static void sanitize_state(struct drbd_resource 
for_each_peer_device_rcu(peer_device, device) {
enum drbd_repl_state nr = peer_device->negotiation_result;
enum drbd_disk_state pdsk = peer_device->disk_state[NEW];
+ enum drbd_disk_state pdsk_old = peer_device->disk_state[OLD];

- if (pdsk == D_UNKNOWN || pdsk < D_NEGOTIATING)
+ if ((pdsk == D_UNKNOWN || pdsk < D_NEGOTIATING) ||
+ (pdsk_old < D_NEGOTIATING && pdsk == D_NEGOTIATING))

if (pdsk == D_UP_TO_DATE)

Sincerely Yours,
Zhang Duan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-dev/attachments/20200302/684d703c/attachment.htm>

More information about the drbd-dev mailing list