Re: [PATCH rdma-next 1/8] RDMA/core: Add rdma_restrack_begin/abort/commit_del() operations
From: Jason Gunthorpe
Date: Thu Jul 02 2026 - 14:30:41 EST
On Wed, Jul 01, 2026 at 03:28:15PM +0300, Edward Srouji wrote:
> +static void restrack_drain_res(struct rdma_restrack_root *rt,
> + struct rdma_restrack_entry *res)
> +{
> + struct rdma_restrack_entry *old;
> +
> + old = xa_cmpxchg(&rt->xa, res->id, res, XA_ZERO_ENTRY, GFP_KERNEL);
> + WARN_ON(old != res);
> +
> + rdma_restrack_put(res);
> + wait_for_completion(&res->comp);
> +}
> + */
> +void rdma_restrack_begin_del(struct rdma_restrack_entry *res)
> +{
> + struct rdma_restrack_root *rt;
> +
> + if (!res->valid)
> + return;
> +
> + if (res->no_track) {
> + rdma_restrack_put(res);
> + wait_for_completion(&res->comp);
> + return;
> + }
> +
> + rt = res_to_rt(res);
> + if (!rt)
> + return;
> +
> + restrack_drain_res(rt, res);
Why the duplicatin of the put and wait? Maybe
restrack_drain_res(NULL, res)
should just skip the xa part? Same for the other functions.
Jason