]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
rhashtable: Kill harmless RCU warning in rhashtable_walk_init
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 19 Dec 2015 02:45:28 +0000 (10:45 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Dec 2015 04:44:18 +0000 (23:44 -0500)
The commit c6ff5268293ef98e48a99597e765ffc417e39fa5 ("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>
lib/rhashtable.c

index eb9240c458fad6a0c4a55b5e211ada4e6aace6b0..51282f5797606545330a29e93b3728d843616ea9 100644 (file)
@@ -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);