Commit 179ccc0a authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

rhashtable: Kill harmless RCU warning in rhashtable_walk_init

The commit c6ff5268 ("rhashtable:
Fix walker list corruption") causes a suspicious RCU usage warning
because we no longer hold ht->mutex when we dereference ht->tbl.

However, this is a false positive because we now hold ht->lock
which also guarantees that ht->tbl won't disppear from under us.

This patch kills the warning by using rcu_dereference_protected.
Reported-by: default avatarkernel test robot <>
Signed-off-by: default avatarHerbert Xu <>
Signed-off-by: default avatarDavid S. Miller <>
parent e905eabc
...@@ -519,7 +519,8 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter) ...@@ -519,7 +519,8 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter)
return -ENOMEM; return -ENOMEM;
spin_lock(&ht->lock); spin_lock(&ht->lock);
iter->walker->tbl = rht_dereference(ht->tbl, ht); iter->walker->tbl =
rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock));
list_add(&iter->walker->list, &iter->walker->tbl->walkers); list_add(&iter->walker->list, &iter->walker->tbl->walkers);
spin_unlock(&ht->lock); spin_unlock(&ht->lock);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment