Re: [PATCH 1/2] RDMA/core: Untrack resources before driver destroy

From: Jason Gunthorpe

Date: Tue Aug 11 2026 - 10:29:14 EST


On Tue, Aug 11, 2026 at 06:56:22PM +0800, Yili Zhang wrote:
> From: Yili Zhang <zhangyili01@xxxxxxxxx>
>
> When a userspace RDMA object cannot be destroyed by the driver during
> ib_uverbs_close() (e.g. mlx5 destroy_cq/destroy_qp fails because the
> hardware is in a transient error state),

That's a bug in of itself, if the HW is erroring then the destroy
should wait for the error to progress past flr and then let the
destroy continue.

> Fix it by moving rdma_restrack_del() to *before* the driver's destroy
> callback, so the restrack entry is removed at the moment we commit to
> destroying the object rather than only on success.

No, that messes up legitimate cases where the destroy is allowed to
fail.

AFAICT the issue here is the netlink is not allowed to access the
context without proper locking.

Jason