aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2017-04-18 12:45:51 -0400
committerDavid S. Miller <davem@davemloft.net>2017-04-20 15:42:10 -0400
commit3d4762639dd36a5f0f433f0c9d82e9743dc21a33 (patch)
tree01aec125286a744e7b6cad15bc2e611940186c2b /net/ipv4/tcp_input.c
parentd02e93d6471c44cc80e407f2c9791bc00fed2e91 (diff)
tcp: remove poll() flakes when receiving RST
When a RST packet is processed, we send two wakeup events to interested polling users. First one by a sk->sk_error_report(sk) from tcp_reset(), followed by a sk->sk_state_change(sk) from tcp_done(). Depending on machine load and luck, poll() can either return POLLERR, or POLLIN|POLLOUT|POLLERR|POLLHUP (this happens on 99 % of the cases) This is probably fine, but we can avoid the confusion by reordering things so that we have more TCP fields updated before the first wakeup. This might even allow us to remove some barriers we added in the past. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a5838858c362..37e2aa925f62 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4008,10 +4008,10 @@ void tcp_reset(struct sock *sk)
4008 /* This barrier is coupled with smp_rmb() in tcp_poll() */ 4008 /* This barrier is coupled with smp_rmb() in tcp_poll() */
4009 smp_wmb(); 4009 smp_wmb();
4010 4010
4011 tcp_done(sk);
4012
4011 if (!sock_flag(sk, SOCK_DEAD)) 4013 if (!sock_flag(sk, SOCK_DEAD))
4012 sk->sk_error_report(sk); 4014 sk->sk_error_report(sk);
4013
4014 tcp_done(sk);
4015} 4015}
4016 4016
4017/* 4017/*