[PATCH v2 01/22] nvmet: add context annotation for nvmet_ns::bdev
Bart Van Assche
bvanassche at acm.org
Wed Nov 18 16:06:36 PST 2026
On 11/17/26 11:34 PM, Nilay Shroff wrote:
> Some accesses to nvmet_ns::bdev in the I/O hotpath do not require
> holding nvmet_subsys::lock, as the namespace reference guarantees that
> the namespace remains valid and the field is not modified while I/O is
> in flight. However, the clang context analyzer cannot express this
> access pattern directly. So introduce nvmet_ns_bdev() as an inline
> helper annotated with __context_unsafe() to allow these accesses
> without requiring the subsystem lock. Convert the relevant accesses in
> the I/O hotpath and other request-processing paths to use this helper.
This is not what __context_unsafe() is intended for. Has it been
considered to introduce a token context lock and to annotate the
functions called with either the namespace reference held or with the
nvmet_subsys::lock held?
> Also pass subsys as an explicit argument to nvmet_p2pmem_ns_add_p2p()
> and nvmet_setup_p2p_ns_map(). This allows their __must_hold()
> annotations and lockdep assertions to reference subsys->lock directly,
> rather than accessing the same lock through ctrl->subsys->lock.
How many changes does this patch include? Should this patch perhaps be
split?
Thanks,
Bart.
More information about the Linux-nvme
mailing list