Re: [PATCH] scsi: iscsi: publish endpoints after transport setup

From: Mike Christie

Date: Wed Jun 17 2026 - 14:46:45 EST


On 6/17/26 1:21 PM, Ruoyu Wang wrote:
> iscsi_create_endpoint() inserts a new endpoint into iscsi_ep_idr before
> transport drivers have initialized their endpoint-private data. The

What is the bug you are fixing with this patch?

We should normally be doing iscsi_lookup_endpoint calls from interface
calls done under the rx_mutex. The ep creation is also done under the
mutex so we should never see a partially setup endpoint.

Is there an async error path where we do a lookup from?


> endpoint handle is returned only after ep_connect() completes, but handles
> are allocated from a predictable IDR and iscsi_lookup_endpoint() looks
> them up directly.
>
> Reserve the endpoint ID with a NULL IDR entry, add
> iscsi_register_endpoint() for the publish step, and call it from the
> in-tree transport drivers after private endpoint setup has completed.
> Until registration, endpoint lookup keeps returning NULL for the reserved
> handle.
>