inet: remove rcu protection on tw_net
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 14 Dec 2011 04:58:33 +0000 (04:58 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Dec 2011 18:34:55 +0000 (13:34 -0500)
commit b099ce2602d806 (net: Batch inet_twsk_purge) added rcu protection
on tw_net for no obvious reason.

struct net are refcounted anyway since timewait sockets escape from rcu
protected sections. tw_net stay valid for the whole timwait lifetime.

This also removes a lot of sparse errors.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/inet_timewait_sock.h

index e8c25b98120523711f115867b247995e1db80a57..ba52c830a7a54569795dcd30a32813e1dc580a75 100644 (file)
@@ -218,20 +218,12 @@ extern void inet_twsk_purge(struct inet_hashinfo *hashinfo,
 static inline
 struct net *twsk_net(const struct inet_timewait_sock *twsk)
 {
-#ifdef CONFIG_NET_NS
-       return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
-                                                 /* reference counting, */
-                                                 /* initialization, or RCU. */
-#else
-       return &init_net;
-#endif
+       return read_pnet(&twsk->tw_net);
 }
 
 static inline
 void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
 {
-#ifdef CONFIG_NET_NS
-       rcu_assign_pointer(twsk->tw_net, net);
-#endif
+       write_pnet(&twsk->tw_net, net);
 }
 #endif /* _INET_TIMEWAIT_SOCK_ */