[PATCH 2/2][PATCH][SRU][Wily][V2] rhashtable: Kill harmless RCU warning in rhashtable_walk_init
Colin King
colin.king at canonical.com
Mon Jan 4 15:13:46 UTC 2016
From: Herbert Xu <herbert at gondor.apana.org.au>
BugLink: https://bugs.launchpad.net/bugs/1526811
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 at linux.intel.com>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: David S. Miller <davem at davemloft.net>
cherry pick from upstream commit 179ccc0a73641ffd24e44ff10a7bd494efe98d8d
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
lib/rhashtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index cce0eed..7292155 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -507,7 +507,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);
--
1.9.1
More information about the kernel-team
mailing list