[PATCH v2 02/22] nvmet: fix nvmet_ns::bdev access using nvmet_subsys::lock
Nilay Shroff
nilay at linux.ibm.com
Thu Nov 19 01:10:11 PST 2026
On 11/19/26 5:38 AM, Bart Van Assche wrote:
> On 11/17/26 11:34 PM, Nilay Shroff wrote:
>> + /*
>> + * Both ctrl->subsys->lock and ns->subsys->lock refer to the
>> + * same lock. However there's no way for us to annotate such
>> + * locking semantics using clang context annotation. So
>> + * explicitly assert the capability.
>> + */
>> + __assume_ctx_lock(&ns->subsys->lock);
>
> __assume_ctx_lock() should be avoided whenever possible. Please either
> modify this function such that "subsys" is passed as an argument or use
> lockdep_assert_held().
>
Yes, okay. I need to extract the namespace iteration into a helper function
and pass subsys as an argument. This will allow to annotate the helper with
__must_hold(&subsys->lock) and then use lockdep_assert_held() to establish
the context for accessing namespace fields, avoiding the explicit use of
__assume_ctx_lock().
Thanks,
--Nilay
More information about the Linux-nvme
mailing list