Commit 51cae673 authored by Amol Grover's avatar Amol Grover Committed by Chuck Lever
Browse files

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: default avatarAmol Grover <frextrite@gmail.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 469aef23
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);