Commit 5c817cec authored by Amol Grover's avatar Amol Grover Committed by Greg Kroah-Hartman

nvmet: Pass lockdep expression to RCU lists

[ Upstream commit 4ac76436 ]

ctrl->subsys->namespaces and subsys->namespaces are traversed with
list_for_each_entry_rcu outside an RCU read-side critical section but
under the protection of ctrl->subsys->lock and subsys->lock respectively.

Hence, add the corresponding lockdep expression to the list traversal
primitive to silence false-positive lockdep warnings, and harden RCU
Reported-by: default avatarkbuild test robot <[email protected]>
Reviewed-by: default avatarJoel Fernandes (Google) <[email protected]>
Signed-off-by: Amol Grover's avatarAmol Grover <[email protected]>
Signed-off-by: default avatarKeith Busch <[email protected]>
Signed-off-by: default avatarSasha Levin <[email protected]>
parent 72c60722
......@@ -555,7 +555,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,
lockdep_is_held(&subsys->lock)) {
BUG_ON(ns->nsid == old->nsid);
if (ns->nsid < old->nsid)
......@@ -1172,7 +1173,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
ctrl->p2p_client = get_device(req->p2p_client);
list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
nvmet_p2pmem_ns_add_p2p(ctrl, ns);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment