[PATCH 01/23] nvmet: add context annotation for nvmet_ns::bdev
Bart Van Assche
bvanassche at acm.org
Thu Nov 12 09:35:34 PST 2026
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/).
Bart.
More information about the Linux-nvme
mailing list