* [PATCH] sunrpc: Pass lockdep expression to RCU lists
@ 2020-02-19 9:35 Amol Grover
2020-03-03 16:37 ` J . Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Amol Grover @ 2020-02-19 9:35 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, J . Bruce Fields, Chuck Lever,
David S . Miller, Jakub Kicinski
Cc: linux-kernel, linux-kernel-mentees, Joel Fernandes,
Madhuparna Bhowmik, Paul E . McKenney, linux-nfs, netdev,
Amol Grover
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>
---
net/sunrpc/cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index f740cb51802a..5db5f5b94726 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -97,7 +97,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)) {
hlist_del_init_rcu(&tmp->cache_list);
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sunrpc: Pass lockdep expression to RCU lists
2020-02-19 9:35 [PATCH] sunrpc: Pass lockdep expression to RCU lists Amol Grover
@ 2020-03-03 16:37 ` J . Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J . Bruce Fields @ 2020-03-03 16:37 UTC (permalink / raw)
To: Amol Grover
Cc: Trond Myklebust, Anna Schumaker, Chuck Lever, David S . Miller,
Jakub Kicinski, linux-kernel, linux-kernel-mentees,
Joel Fernandes, Madhuparna Bhowmik, Paul E . McKenney, linux-nfs,
netdev
On Wed, Feb 19, 2020 at 03:05:05PM +0530, Amol Grover wrote:
> 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.
Thanks, applying for 5.7.--b.
>
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
> net/sunrpc/cache.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index f740cb51802a..5db5f5b94726 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -97,7 +97,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)) {
> hlist_del_init_rcu(&tmp->cache_list);
> --
> 2.24.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-03 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 9:35 [PATCH] sunrpc: Pass lockdep expression to RCU lists Amol Grover
2020-03-03 16:37 ` J . Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).