Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: "zhengbing.huang" <zhengbing.huang@easystack.cn>
To: drbd-dev@lists.linbit.com
Subject: [PATCH] rdma: Fix drbd_transport_rdma module reference count exception
Date: Wed, 19 Feb 2025 11:08:04 +0800	[thread overview]
Message-ID: <20250219030804.1389397-1-zhengbing.huang@easystack.cn> (raw)

In testing, we find drbd_transport_rdma module reference count is abnormal:
drbd_transport_rdma 262144 28293

we don't have that many drbd devices.

If the XXX_ADDR_ERROR/XXX_ROUTE_ERROR events occurs
and the DSB_CONNECTING flag bit is not set,
the dtr_cma_event_handler() returns 0 directly.
The cm structure cannot be destroyed,
and the drbd_transport_rdma module reference count is abnormal.

So, for XXX_ADDR_ERROR/XXX_ROUTE_ERROR events,
we do not need to judge the DSB_CONNECTING flag,
and we need to kref_put of cm structure.

Signed-off-by: zhengbing.huang <zhengbing.huang@easystack.cn>
---
 drbd/drbd_transport_rdma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drbd/drbd_transport_rdma.c b/drbd/drbd_transport_rdma.c
index ba4f1baa7..bb59e6501 100644
--- a/drbd/drbd_transport_rdma.c
+++ b/drbd/drbd_transport_rdma.c
@@ -1292,6 +1292,11 @@ static int dtr_cma_event_handler(struct rdma_cm_id *cm_id, struct rdma_cm_event
 		// pr_info("%s: RDMA_CM_EVENT_ADDR_ERROR\n", cm->name);
 	case RDMA_CM_EVENT_ROUTE_ERROR:
 		// pr_info("%s: RDMA_CM_EVENT_ROUTE_ERROR\n", cm->name);
+		set_bit(DSB_ERROR, &cm->state);
+
+		dtr_cma_retry_connect(cm->path, cm);
+		break;
+
 	case RDMA_CM_EVENT_CONNECT_ERROR:
 		// pr_info("%s: RDMA_CM_EVENT_CONNECT_ERROR\n", cm->name);
 	case RDMA_CM_EVENT_UNREACHABLE:
-- 
2.43.0


             reply	other threads:[~2025-02-19  3:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  3:08 zhengbing.huang [this message]
2025-03-12  8:54 ` [PATCH] rdma: Fix drbd_transport_rdma module reference count exception Philipp Reisner

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=20250219030804.1389397-1-zhengbing.huang@easystack.cn \
    --to=zhengbing.huang@easystack.cn \
    --cc=drbd-dev@lists.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