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

From: Patrisious Haddad

Date: Tue Apr 07 2026 - 05:21:28 EST



On 4/7/2026 1:23 AM, Jason Gunthorpe wrote:
External email: Use caution opening links or attachments


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.
Usually del/add pairs not good due to re-addition possibility of failure , here that cant happen ... so any reason why it is still considered bad ?

The problem with marking as deletion here is that it is not only the xarray that is being done at the delete operation (there is restrack_put and wait_for_completion inside the restrack del to sync with other threads that are ongoing).
I don't really see how to pre-delete it correctly without actually deleting in this case.

    - Patrisious

Jason