Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aibing Chen" <chenaibing@cmss.chinamobile.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net v2] net/rds: defer CM id destruction to a workqueue
Date: Tue, 17 Nov 2026 07:54:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-218388@kernel.org> (raw)
In-Reply-To: <20261116075423.782-1-chenaibing@cmss.chinamobile.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net/rds: synchronous rdma_destroy_id() fallback in
  rds_ib_laddr_check_cm()
--

commit 26cfa811c05ca14cedb9fc00446b35dbd44dc87e
Author: Aibing Chen <chenaibing@cmss.chinamobile.com>

net/rds: defer CM id destruction to a workqueue

This commit defers rdma_destroy_id() from rds_ib_laddr_check_cm() to
rds_wq to avoid taking handler_mutex while rds_trans_sem is held, and
flushes rds_wq in rds_ib_exit().

> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index 4ea9838d090c3..66af4a72a5595 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
[ ... ]
> @@ -419,6 +434,15 @@ static int rds_ib_laddr_check_cm(struct net *net, const struct in6_addr *addr,
>  			       NULL, RDMA_PS_TCP, IB_QPT_RC);
>  	if (IS_ERR(cm_id))
>  		return PTR_ERR(cm_id);
> +
> +	/*
> +	 * The id is destroyed from rds_wq: rds_trans_get_preferred() calls this
> +	 * function with rds_trans_sem held for reading, and rdma_destroy_id()
> +	 * takes handler_mutex, which the CM callback path acquires before
> +	 * taking rds_trans_sem.  If the allocation fails, fall back to the
> +	 * synchronous destroy.
> +	 */
> +	w = kzalloc_obj(*w, GFP_KERNEL);
>  	ret = rdma_restrict_node_type(cm_id, RDMA_NODE_IB_CA);
>  	if (ret)
>  		goto out;
> @@ -484,7 +508,13 @@ static int rds_ib_laddr_check_cm(struct net *net, const struct in6_addr *addr,
>  		 cm_id->device ? cm_id->device->node_type : -1);
>  
>  out:
> -	rdma_destroy_id(cm_id);
> +	if (w) {
> +		INIT_WORK(&w->work, rds_ib_destroy_id_work);
> +		w->cm_id = cm_id;
> +		queue_work(rds_wq, &w->work);
> +	} else {
> +		rdma_destroy_id(cm_id);
> +	}
>  
>  	return ret;
>  }

[Severity: Medium]
Can the fallback to synchronous rdma_destroy_id(cm_id) when
kzalloc_obj(*w, GFP_KERNEL) fails still trigger the rds_trans_sem ->
handler_mutex ABBA deadlock this patch fixes?

Allocating w before rdma_create_id() (returning -ENOMEM if !w and freeing
w if IS_ERR(cm_id)) would ensure cm_id is never created without a work
item to destroy it.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116075423.782-1-chenaibing@cmss.chinamobile.com?part=1

  parent reply	other threads:[~2026-11-17  7:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 15:05 [PATCH] RDMA/cma: add rdma_destroy_id_wq() and use it from RDS Aibing Chen
2026-11-15  0:18 ` Jason Gunthorpe
2026-11-16  6:47   ` Allison Henderson
2026-11-15 15:05 ` sashiko-bot
2026-11-16  7:54 ` [PATCH net v2] net/rds: defer CM id destruction to a workqueue Aibing Chen
2026-11-17  6:15   ` Allison Henderson
2026-11-17  7:54   ` sashiko-bot [this message]
2026-11-17  8:21   ` [PATCH net v3] " Aibing Chen
2026-11-17  8:33     ` sashiko-bot
2026-11-17  8:35   ` [PATCH net v2] " netdev-bot+sashiko

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=sashiko-outbox-218388@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chenaibing@cmss.chinamobile.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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