diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-12-13 23:58:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-14 13:34:55 -0500 |
commit | f943cbe6fb71d1389dd8684b9b4181e49f8e870c (patch) | |
tree | e895be7b8d2985e0123ad48500005d2a86eac101 /include/net/inet_timewait_sock.h | |
parent | e6560d4dfe62ddf6010fdf4a417b1b3bdcbf4fd3 (diff) |
inet: remove rcu protection on tw_net
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>
Diffstat (limited to 'include/net/inet_timewait_sock.h')
-rw-r--r-- | include/net/inet_timewait_sock.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index e8c25b981205..ba52c830a7a5 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -218,20 +218,12 @@ extern void inet_twsk_purge(struct inet_hashinfo *hashinfo, | |||
218 | static inline | 218 | static inline |
219 | struct net *twsk_net(const struct inet_timewait_sock *twsk) | 219 | struct net *twsk_net(const struct inet_timewait_sock *twsk) |
220 | { | 220 | { |
221 | #ifdef CONFIG_NET_NS | 221 | return read_pnet(&twsk->tw_net); |
222 | return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */ | ||
223 | /* reference counting, */ | ||
224 | /* initialization, or RCU. */ | ||
225 | #else | ||
226 | return &init_net; | ||
227 | #endif | ||
228 | } | 222 | } |
229 | 223 | ||
230 | static inline | 224 | static inline |
231 | void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) | 225 | void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) |
232 | { | 226 | { |
233 | #ifdef CONFIG_NET_NS | 227 | write_pnet(&twsk->tw_net, net); |
234 | rcu_assign_pointer(twsk->tw_net, net); | ||
235 | #endif | ||
236 | } | 228 | } |
237 | #endif /* _INET_TIMEWAIT_SOCK_ */ | 229 | #endif /* _INET_TIMEWAIT_SOCK_ */ |