[PATCH 1/2] nvmet: defer setting ns->enabled to false in nvmet_ns_disable()
Christoph Hellwig
hch at lst.de
Fri Sep 18 05:08:25 PDT 2026
On Wed, Sep 16, 2026 at 08:39:59PM +0530, Nilay Shroff wrote:
> In nvmet_ns_disable(), keep ns->enabled set while existing namespace
> references are being drained, so namespace configuration remains blocked
> until all in-flight I/O has completed. Set ns->enabled to false only
> after the namespace references have been drained and the namespace
> device has been disabled.
>
> Since setting ns->enabled to false is deferred in nvmet_ns_disable(),
> use the NVMET_NS_ENABLED XArray mark in nvmet_req_find_ns() to
> determine whether a namespace can accept new I/O.
>
> Similarly, use the NVMET_NS_ENABLED XArray mark in nvmet_ns_disable()
> to prevent concurrent callers from starting namespace disable.
This does look sane, but have you looked at profiles if getting the
xarray tag might touch a lot more cache lines vs the flag? It might
make sense to turn enabled into an atomic bit mask and just have two
flags in there.
More information about the Linux-nvme
mailing list