[Linux-kernel-mentees] [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists

Keith Busch kbusch at kernel.org
Fri Jan 10 16:31:34 UTC 2020


On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)

This macro requires "struct nvmet_subsys *subsys" was previously declared
in the function using it, which isn't obvious when looking at the users. I
don't think that's worth the conciseness.

> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;


More information about the Linux-kernel-mentees mailing list