2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00

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>
This commit is contained in:
Amol Grover 2020-02-19 15:05:05 +05:30 committed by Chuck Lever
parent 469aef23aa
commit 51cae673d0

View File

@ -113,7 +113,8 @@ static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail,
spin_lock(&detail->hash_lock); spin_lock(&detail->hash_lock);
/* check if entry appeared while we slept */ /* 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 (detail->match(tmp, key)) {
if (cache_is_expired(detail, tmp)) { if (cache_is_expired(detail, tmp)) {
sunrpc_begin_cache_remove_entry(tmp, detail); sunrpc_begin_cache_remove_entry(tmp, detail);