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

Bart Van Assche bvanassche at acm.org
Wed Nov 11 10:00:52 PST 2026


On 11/10/26 11:25 PM, Nilay Shroff wrote:
> Attached the complete patch for your reference. Even after making
> this change, clang still complains about locking violation:
> 
> drivers/nvme/target/nvmet.h:255:13: error: reading variable 'bdev' 
> requires holding mutex 'ns->subsys->lock' [-Werror,-Wthread-safety-precise]
>    255 |         return ns->bdev ? disk_to_dev(ns->bdev->bd_disk) : NULL;
>        |                    ^
> drivers/nvme/target/nvmet.h:255:13: note: found near match 'subsys->lock'

This can be solved by adding a lockdep_assert_held(&ms->bdev->bd_disk)
statement, isn't it?

Thanks,

Bart.



More information about the Linux-nvme mailing list