Re: [PATCH rdma-next v2 03/11] RDMA/core: Preserve restrack resource ID on reinsertion

From: Jason Gunthorpe

Date: Mon Apr 06 2026 - 18:24:38 EST


On Mon, Apr 06, 2026 at 12:11:14PM +0300, Edward Srouji wrote:
> From: Patrisious Haddad <phaddad@xxxxxxxxxx>
>
> rdma_restrack_add() currently always allocates a new ID via
> xa_alloc_cyclic(), regardless of whether res->id is already set.
> This change makes sure that the object’s ID remains the same across
> removal and reinsertion to restrack.

It would be better to somehow pre-delete it so it is still in the
xarray but somehow blocked and then allow un pre-deleting. del/add
pairs are not a good design.

Jason