[PATCH 04/15] nvme: add Clang context annotations for nvme_ns_head::requeue_list

Bart Van Assche bvanassche at acm.org
Wed Jun 10 09:25:51 PDT 2026


On 6/10/26 7:27 AM, Nilay Shroff wrote:
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index a275c03e7c59..985a8c693c6f 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -706,8 +706,8 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
>   	struct queue_limits lim;
>   
>   	mutex_init(&head->lock);
> +	guard(spinlock_init)(&head->requeue_lock);
>   	bio_list_init(&head->requeue_list);
> -	spin_lock_init(&head->requeue_lock);
scoped_guard() is preferred over guard() because with scoped_guard() the
scope the guard applies to is explicit. When using guard(), if new code
is added, it may end up being covered by a guard() statement although it
shouldn't.

Thanks,

Bart.



More information about the Linux-nvme mailing list