<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial">Hi <span style="white-space: pre-wrap">Philipp,</span><div><span style="white-space: pre-wrap"><br></span></div><div>Thank you for your reply. <br></div><div>We'll get to know those patches.</div><div><br></div><div  style="position:relative;zoom:1"></div><div>Best regards,</div><div>zhengbing<br></div><div><br></div><pre><br>From: Philipp Reisner &lt;philipp.reisner@linbit.com&gt;
Date: 2024-10-17 00:44:40
To:  Dongsheng Yang &lt;dongsheng.yang@easystack.cn&gt;
Cc:  "zhengbing.huang" &lt;zhengbing.huang@easystack.cn&gt;,drbd-dev@lists.linbit.com,dongsheng.yang@linux.dev
Subject: Re: [PATCH 03/11] drbd_transport_rdma: put kref for cm in dtr_path_established in error path&gt;Hello easystack team,
&gt;
&gt;I probably fixed the (or some of the) problems you intended to fix
&gt;with this patch series.
&gt;
&gt;Please see these recent commits on the master branch:
&gt;
&gt;3f82aed6e drbd_transport: fix a use after free in drbd_get_listener()
&gt;1f2f11c47 rdma: remove dtr_path_established()
&gt;e38120f3d rdma: Fix leaking a cm_id object
&gt;e0f5e307e rdma: fix superficial kref_put() in error code path in
&gt;dtr_cma_accept()
&gt;35a6b002c rdma: fix concurrency of activate_path() and __dtr_disconnect_path()
&gt;6ccd39432 rdma: fix an access after free() in dtr_destroy_cm()
&gt;5a711b347 rdma: fix free() of scheduled delayed_work
&gt;847aab659 rdma: remove misguided kref_get()/kref_put()
&gt;
&gt;I will go over your patch series and your comments. I'm sorry I
&gt;dropped the ball on this. I was out on vacation in July, and when I
&gt;came back, 1000 things needed my attention.
&gt;
&gt;Best regards,
&gt; Philipp
&gt;
&gt;On Mon, Jul 1, 2024 at 4:48 AM Dongsheng Yang
&gt;&lt;dongsheng.yang@easystack.cn&gt; wrote:
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt; 在 2024/7/1 星期一 上午 10:07, Dongsheng Yang 写道:
&gt;&gt; &gt;
&gt;&gt; &gt;
&gt;&gt; &gt; 在 2024/6/28 星期五 下午 5:40, Philipp Reisner 写道:
&gt;&gt; &gt;&gt; Hello Dongsheng,
&gt;&gt; &gt;&gt;
&gt;&gt; &gt;&gt; Please add more information why you think this change fixes a bug.
&gt;&gt; &gt;&gt; Have you experienced a leak of cm structs?
&gt;&gt; &gt;&gt; We got a RDMA_CM_EVENT_ESTABLISHED event. Even if DRBD does not do
&gt;&gt; &gt;&gt; anything with this cm, we sill expect a RDMA_CM_EVENT_DISCONNECTED in
&gt;&gt; &gt;&gt; the future. Is a problem in the handling of the disconnect?
&gt;&gt; &gt;
&gt;&gt; &gt; If dtr_path_established() go into this branch, it will not
&gt;&gt; &gt; schedule_work(&amp;cm-&gt;establish_work);
&gt;&gt; &gt;
&gt;&gt; &gt; That means path-&gt;cm-&gt;state = DSM_CONNECTED; will not be done in
&gt;&gt; &gt; dtr_path_established_work_fn(), so __dtr_disconnect_path() will not call
&gt;&gt; &gt; rdma_disconnect(). That means this reference will never be put.
&gt;&gt;
&gt;&gt; let me consider this  example:
&gt;&gt; a) rdma_connect() called and RDMA_CM_EVENT_ESTABLISHED received.
&gt;&gt;
&gt;&gt; b) network failure and dtr_path_established() go into error path.
&gt;&gt;
&gt;&gt; c) establish_work will not be scheduled.
&gt;&gt;
&gt;&gt; d) drbdadm down test will hang because cm ref is not put.
&gt;&gt; &gt;&gt;
&gt;&gt; &gt;&gt; best regards,
&gt;&gt; &gt;&gt;   Philipp
&gt;&gt; &gt;&gt;
&gt;&gt; &gt;&gt; On Mon, Jun 24, 2024 at 9:28 AM zhengbing.huang
&gt;&gt; &gt;&gt; &lt;zhengbing.huang@easystack.cn&gt; wrote:
&gt;&gt; &gt;&gt;&gt;
&gt;&gt; &gt;&gt;&gt; From: Dongsheng Yang &lt;dongsheng.yang@easystack.cn&gt;
&gt;&gt; &gt;&gt;&gt;
&gt;&gt; &gt;&gt;&gt; Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@easystack.cn&gt;
&gt;&gt; &gt;&gt;&gt; ---
&gt;&gt; &gt;&gt;&gt;   drbd/drbd_transport_rdma.c | 1 +
&gt;&gt; &gt;&gt;&gt;   1 file changed, 1 insertion(+)
&gt;&gt; &gt;&gt;&gt;
&gt;&gt; &gt;&gt;&gt; diff --git a/drbd/drbd_transport_rdma.c b/drbd/drbd_transport_rdma.c
&gt;&gt; &gt;&gt;&gt; index cfbae0e78..eccd0c6ce 100644
&gt;&gt; &gt;&gt;&gt; --- a/drbd/drbd_transport_rdma.c
&gt;&gt; &gt;&gt;&gt; +++ b/drbd/drbd_transport_rdma.c
&gt;&gt; &gt;&gt;&gt; @@ -922,6 +922,7 @@ static void dtr_path_established(struct dtr_cm *cm)
&gt;&gt; &gt;&gt;&gt;                          atomic_set(&amp;cs-&gt;active_state, PCS_INACTIVE);
&gt;&gt; &gt;&gt;&gt;                          wake_up(&amp;cs-&gt;wq);
&gt;&gt; &gt;&gt;&gt;                  }
&gt;&gt; &gt;&gt;&gt; +               kref_put(&amp;cm-&gt;kref, dtr_destroy_cm);
&gt;&gt; &gt;&gt;&gt;                  return;
&gt;&gt; &gt;&gt;&gt;          }
&gt;&gt; &gt;&gt;&gt;
&gt;&gt; &gt;&gt;&gt; --
&gt;&gt; &gt;&gt;&gt; 2.27.0
&gt;&gt; &gt;&gt;&gt;
</pre></div><br>