Re: [PATCH 1/2] nvmet: defer setting ns->enabled to false in nvmet_ns_disable()
From: Nilay Shroff
Date: Fri Sep 18 2026 - 11:41:22 EST
On 9/18/26 5:38 PM, Christoph Hellwig wrote:
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.
Yes, you were correct. Using the XArray mark in the I/O path touches
significantly more cache lines.
I'll fix this as you suggested by using atomic bit flags and send out
the next revision.
Thanks,
--Nilay