[PATCH 01/23] nvmet: add context annotation for nvmet_ns::bdev

Nilay Shroff nilay at linux.ibm.com
Fri Nov 13 00:54:26 PST 2026


On 11/12/26 11:05 PM, Bart Van Assche wrote:
> On 11/12/26 1:04 AM, Nilay Shroff wrote:
>> And yes, adding the lockdep assertion resolves the compilation error.
>> As I see now (frankly I was not aware about this earlier), lockdep
>> internally assumes the required capability, which allows Clang's context
>> analyzer to satisfy the corresponding lock annotation.
>>
>> So as you suggested, for complex call paths involving multiple locks,
>> where the same lock may be accessed through different expressions, I'll
>> use the appropriate lockdep_assert_held() assertions instead of explicitly
>> adding __assume_ctx_lock() annotations as far as possible.
> 
> Thanks!
> 
> Something that you may want to know is that I'm proposing to remove __assume_ctx_lock() again from lockdep_assert_held() and to introduce
> a new macro lockdep_assume_ctx_held(). So far no agreement has been
> reached about these changes. See also "[PATCH v2 00/14] Stop
> lockdep_assert_held*() from assuming lock ownership"
> (https://lore.kernel.org/lkml/cover.1794250850.git.bvanassche@acm.org/).
> 
Okay, nice! I had a quick look through the series. Since there hasn't been a
consensus yet on introducing the new lockdep macros, lockdep_assume_ctx_held()
and lockdep_assume_shared_ctx_held(), I'll continue using lockdep_assert_held()
instead of explicitly adding __assume_ctx_lock() annotations wherever possible.

If your proposed series is accepted, I can update the assertions accordingly.
I think this would be a reasonable approach for now. Based on this, I'll re-spin
my patchset incorporating your suggestions. Please let me know. in case, you
have any concerns with this approach.

Thanks,
--Nilay



More information about the Linux-nvme mailing list