summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmol Grover <frextrite@gmail.com>2020-02-19 15:05:05 +0530
committerChuck Lever <chuck.lever@oracle.com>2020-03-16 12:04:31 -0400
commit51cae673d036a32fe5cca9ec61765aa09e322c59 (patch)
tree4b8bfaa7a8bbd0d2b8cfc2e7c86db735477c380a
parent469aef23aa4e49d5191050410a1422117db03e11 (diff)
sunrpc: Pass lockdep expression to RCU lists
detail->hash_table[] is traversed using hlist_for_each_entry_rcu outside an RCU read-side critical section but under the protection of detail->hash_lock. Hence, add corresponding lockdep expression to silence false-positive warnings, and harden RCU lists. Signed-off-by: Amol Grover <frextrite@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
-rw-r--r--net/sunrpc/cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index bd843a81afa0..8a8e3528293c 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -113,7 +113,8 @@ static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail,
spin_lock(&detail->hash_lock);
/* check if entry appeared while we slept */
- hlist_for_each_entry_rcu(tmp, head, cache_list) {
+ hlist_for_each_entry_rcu(tmp, head, cache_list,
+ lockdep_is_held(&detail->hash_lock)) {
if (detail->match(tmp, key)) {
if (cache_is_expired(detail, tmp)) {
sunrpc_begin_cache_remove_entry(tmp, detail);