Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Rui Xu <rui.xu@easystack.cn>
To: philipp.reisner@linbit.com, drbd-dev@lists.linbit.com,
	joel.colledge@linbit.com
Cc: Rui Xu <rui.xu@easystack.cn>, dongsheng.yang@easystack.cn
Subject: [Drbd-dev] [PATCH] drbd: fix a bug of got_peer_ack
Date: Wed, 21 Sep 2022 17:07:10 +0800	[thread overview]
Message-ID: <20220921090710.2238953-1-rui.xu@easystack.cn> (raw)

Consider a scenrio that io is ongoing and the backing disk of
secondary drbd suddenly broken. Some requset from primary node
will not be processed in receive_Data since there is no ldev.
And primary node will send peer_ack to secondary node for those
requsets, but the secondary node will not find these requests in
got_peer_ack.

The first problem caused by this bug is that the two nodes will be
disconnected, and the second problem is that some peer requests
can't be destroyed.

Fix it by find the last peer request on peer_requests list and then
the remaining requests on the list will be destroyed.

Signed-off-by: Rui Xu <rui.xu@easystack.cn>
---
 drbd/drbd_receiver.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
index 656d4eced..b63e83f52 100644
--- a/drbd/drbd_receiver.c
+++ b/drbd/drbd_receiver.c
@@ -9343,6 +9343,13 @@ static int got_peer_ack(struct drbd_connection *connection, struct packet_info *
 		if (dagtag == peer_req->dagtag_sector)
 			goto found;
 	}
+
+        list_for_each_entry(peer_req, &connection->peer_requests, recv_order) {
+                if (peer_req->dagtag_sector == atomic64_read(&connection->last_dagtag_sector)) {
+                        drbd_info(connection, "peer request with last dagtag sector %llu has found\n", peer_req->dagtag_sector);
+                        goto found;
+                }
+        }
 	spin_unlock_irq(&connection->peer_reqs_lock);
 
 	drbd_err(connection, "peer request with dagtag %llu not found\n", dagtag);
-- 
2.25.1


             reply	other threads:[~2022-09-21  9:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  9:07 Rui Xu [this message]
2022-09-29  9:39 ` [Drbd-dev] [PATCH] drbd: fix a bug of got_peer_ack Joel Colledge

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=20220921090710.2238953-1-rui.xu@easystack.cn \
    --to=rui.xu@easystack.cn \
    --cc=dongsheng.yang@easystack.cn \
    --cc=drbd-dev@lists.linbit.com \
    --cc=joel.colledge@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