All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: lirongqing <lirongqing@baidu.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/restrack: Don't set RESTRACK_DD mark after a failed xa_insert()
Date: Wed, 16 Sep 2026 07:36:20 +0000	[thread overview]
Message-ID: <20260916073620.A43C71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916073042.1746-1-lirongqing@baidu.com>

> From: Li RongQing <lirongqing@baidu.com>
> 
> When adding a QP to the restrack xarray, rdma_restrack_add() does:
> 
> 	ret = xa_insert(&rt->xa, res->id, res, GFP_KERNEL);
> 	if (ret)
> 		res->id = 0;
> 
> 	if (qp->qp_type >= IB_QPT_DRIVER)
> 		xa_set_mark(&rt->xa, res->id, RESTRACK_DD);
> 
> The xa_set_mark() call is not guarded by "!ret".  When xa_insert() fails
> (possible on a qp_num collision or memory pressure), res->id is reset to
> 0, yet the mark is still applied to index 0.  If a legitimate QP whose
> qp_num is 0 already occupies that slot - e.g. a normal QP or the SMI QP
> - it is spuriously tagged as driver-private (RESTRACK_DD), and the
> netlink dump path res_get_common_dumpit() then hides it from "rdma res"
> output whenever the caller does not request driver details.
> 
> Only set the mark when the insertion actually succeeded by folding the
> mark into the non-failure branch.
> 
> Fixes: e18fa0bbcedf8 ("RDMA/core: Add an option to display driver-specific QPs in the rdmatool")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916073042.1746-1-lirongqing@baidu.com?part=1


  reply	other threads:[~2026-09-16  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  7:30 [PATCH] RDMA/restrack: Don't set RESTRACK_DD mark after a failed xa_insert() lirongqing
2026-09-16  7:36 ` sashiko-bot [this message]
2026-09-18 12:49 ` Leon Romanovsky

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=20260916073620.A43C71F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.