diff options
author | Eric Dumazet <edumazet@google.com> | 2018-02-13 06:14:12 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-14 14:21:45 -0500 |
commit | e0f9759f530bf789e984961dce79f525b151ecf3 (patch) | |
tree | 8f384615d4648a8fc46c70db06dd9021a0a480b4 /include/net/tcp.h | |
parent | 1d631583ae5e40681dc9a41d7cfa845222c3c7ff (diff) | |
download | linux-e0f9759f530bf789e984961dce79f525b151ecf3.tar.gz linux-e0f9759f530bf789e984961dce79f525b151ecf3.tar.bz2 linux-e0f9759f530bf789e984961dce79f525b151ecf3.zip |
tcp: try to keep packet if SYN_RCV race is lost
배석진 reported that in some situations, packets for a given 5-tuple
end up being processed by different CPUS.
This involves RPS, and fragmentation.
배석진 is seeing packet drops when a SYN_RECV request socket is
moved into ESTABLISH state. Other states are protected by socket lock.
This is caused by a CPU losing the race, and simply not caring enough.
Since this seems to occur frequently, we can do better and perform
a second lookup.
Note that all needed memory barriers are already in the existing code,
thanks to the spin_lock()/spin_unlock() pair in inet_ehash_insert()
and reqsk_put(). The second lookup must find the new socket,
unless it has already been accepted and closed by another cpu.
Note that the fragmentation could be avoided in the first place by
use of a correct TCP MSS option in the SYN{ACK} packet, but this
does not mean we can not be more robust.
Many thanks to 배석진 for a very detailed analysis.
Reported-by: 배석진 <soukjin.bae@samsung.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index e3fc667f9ac2..92b06c6e7732 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -374,7 +374,8 @@ enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb, const struct tcphdr *th); struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, - struct request_sock *req, bool fastopen); + struct request_sock *req, bool fastopen, + bool *lost_race); int tcp_child_process(struct sock *parent, struct sock *child, struct sk_buff *skb); void tcp_enter_loss(struct sock *sk); |