From: Paul E. McKenney Date: Tue, 27 Apr 2010 06:22:01 +0000 (+0000) Subject: net: suppress RCU lockdep false positive in twsk_net() X-Git-Tag: v2.6.35-rc1~473^2~378 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=7ec75c582e639d956ce3afd499f67febe6f902a4;p=linux.git net: suppress RCU lockdep false positive in twsk_net() Calls to twsk_net() are in some cases protected by reference counting as an alternative to RCU protection. Cases covered by reference counts include __inet_twsk_kill(), inet_twsk_free(), inet_twdr_do_twkill_work(), inet_twdr_twcal_tick(), and tcp_timewait_state_process(). RCU is used by inet_twsk_purge(). Locking is used by established_get_first() and established_get_next(). Finally, __inet_twsk_hashdance() is an initialization case. It appears to be non-trivial to locate the appropriate locks and reference counts from within twsk_net(), so used rcu_dereference_raw(). Signed-off-by: Paul E. McKenney Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 79f67eae8a7e..a066fdd50da6 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h @@ -224,7 +224,9 @@ static inline struct net *twsk_net(const struct inet_timewait_sock *twsk) { #ifdef CONFIG_NET_NS - return rcu_dereference(twsk->tw_net); + return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */ + /* reference counting, */ + /* initialization, or RCU. */ #else return &init_net; #endif