Skip to content

Commit 51cae67

Browse files
frextritechucklever
authored andcommitted
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>
1 parent 469aef2 commit 51cae67

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/sunrpc/cache.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail,
113113
spin_lock(&detail->hash_lock);
114114

115115
/* check if entry appeared while we slept */
116-
hlist_for_each_entry_rcu(tmp, head, cache_list) {
116+
hlist_for_each_entry_rcu(tmp, head, cache_list,
117+
lockdep_is_held(&detail->hash_lock)) {
117118
if (detail->match(tmp, key)) {
118119
if (cache_is_expired(detail, tmp)) {
119120
sunrpc_begin_cache_remove_entry(tmp, detail);

0 commit comments

Comments
 (0)