OSDN Git Service

tcp: remove poll() flakes with FastOpen
authorEric Dumazet <edumazet@google.com>
Tue, 18 Apr 2017 16:45:52 +0000 (09:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Mar 2018 10:00:12 +0000 (11:00 +0100)
commit5f63431093a2be7ac048f6ce072e3606eb70c87c
treeccb7d8caff51232a46c49c35c96acfe35d0484c2
parent76441e151c0a4950cdbf014c2377895f48fba2c6
tcp: remove poll() flakes with FastOpen

[ Upstream commit 0f9fa831aecfc297b7b45d4f046759bcefcf87f0 ]

When using TCP FastOpen for an active session, we send one wakeup event
from tcp_finish_connect(), right before the data eventually contained in
the received SYNACK is queued to sk->sk_receive_queue.

This means that depending on machine load or luck, poll() users
might receive POLLOUT events instead of POLLIN|POLLOUT

To fix this, we need to move the call to sk->sk_state_change()
after the (optional) call to tcp_rcv_fastopen_synack()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/tcp_input.c