Skip to content

Commit

Permalink
rhashtable: Kill harmless RCU warning in rhashtable_walk_init
Browse files Browse the repository at this point in the history
The commit c6ff526 ("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: kernel test robot <ying.huang@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
herbertx authored and davem330 committed Dec 19, 2015
1 parent e905eab commit 179ccc0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rhashtable.c
Expand Up @@ -519,7 +519,8 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter)
return -ENOMEM;

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);
spin_unlock(&ht->lock);

Expand Down

0 comments on commit 179ccc0

Please sign in to comment.