aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-10-08 14:16:48 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-11 08:33:15 -0400
commit6bcfd7f8c28887a4298bc4386b02cb90c9fa0c13 (patch)
tree34a3fa802965d1c97f5c242b79436bb648fa13c9 /net
parent5010ea59e1b986d89023c0552fa38e32b519a617 (diff)
tcp: fix RFS vs lockless listeners
Before recent TCP listener patches, we were updating listener sk->sk_rxhash before the cloning of master socket. children sk_rxhash was therefore correct after the normal 3WHS. But with lockless listener, we no longer dirty/change listener sk_rxhash as it would be racy. We need to correctly update the child sk_rxhash, otherwise first data packet wont hit correct cpu if RFS is used. Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Willem de Bruijn <willemb@google.com> Cc: Tom Herbert <tom@herbertland.com> Acked-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/syncookies.c1
-rw-r--r--net/ipv4/tcp_minisocks.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 8113c30ccf96..2dbb11331f6c 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -225,6 +225,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
225 child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst); 225 child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst);
226 if (child) { 226 if (child) {
227 atomic_set(&req->rsk_refcnt, 1); 227 atomic_set(&req->rsk_refcnt, 1);
228 sock_rps_save_rxhash(child, skb);
228 inet_csk_reqsk_queue_add(sk, req, child); 229 inet_csk_reqsk_queue_add(sk, req, child);
229 } else { 230 } else {
230 reqsk_free(req); 231 reqsk_free(req);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 9adf1e2c3170..1079e6ad77fe 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -768,6 +768,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
768 if (!child) 768 if (!child)
769 goto listen_overflow; 769 goto listen_overflow;
770 770
771 sock_rps_save_rxhash(child, skb);
771 tcp_synack_rtt_meas(child, req); 772 tcp_synack_rtt_meas(child, req);
772 inet_csk_reqsk_queue_drop(sk, req); 773 inet_csk_reqsk_queue_drop(sk, req);
773 inet_csk_reqsk_queue_add(sk, req, child); 774 inet_csk_reqsk_queue_add(sk, req, child);