[PATCH 11/23] nvmet: add context annotation for nvmet_ns::uuid
Nilay Shroff
nilay at linux.ibm.com
Tue Nov 10 01:01:34 PST 2026
On 11/10/26 3:28 AM, Bart Van Assche wrote:
> On 11/8/26 7:28 PM, Nilay Shroff wrote:
>> [ ... ]
>
> This patch breaks compilation in nvmet_ns_alloc() because uuid_gen(&ns->uuid)
> is called without holding subsys->lock. This is fixed only in patch 12.
> Please move patch 12 before patch 11 (or squash them).
The intention of this series is to first annotate a field in struct nvmet_ns
and then address any locking violations reported by the clang context analyzer
in a subsequent patch. I split the annotation and the corresponding locking
changes into separate patches to make the changes easier to review.
Also, since I haven't enabled CONTEXT_ANALYSIS:= y in the NVMe target Makefile yet,
enabling CONFIG_WARN_CONTEXT_ANALYSIS alone should not cause this compilation
failure.
> In nvmet_ns_device_uuid_show(), please use guard(mutex)(&ns->subsys->lock).
> Do you think using guard(...) is more appropriate then simple mutex_lock()
and mutex_unlock() APIs? I find using conventional mutex_lock()/mutex_unlcok()
APIs more readable and easy to reason about then using guard(...). That said,
if others as well prefer using guard() them I'm open to switch to it.
Thanks,
--Nilay
More information about the Linux-nvme
mailing list