aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_connection_sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-17 21:32:30 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-17 22:01:56 -0400
commite3d95ad7da4f8955599f0786d7c70497c0aaf8c9 (patch)
treec427b35237fcb5ee29cc973d96c1d8b893bb7491 /net/ipv4/inet_connection_sock.c
parent9439ce00f208d95703a6725e4ea986dd90e37ffd (diff)
inet: avoid fastopen lock for regular accept()
It is not because a TCP listener is FastOpen ready that all incoming sockets actually used FastOpen. Avoid taking queue->fastopenq->lock if not needed. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r--net/ipv4/inet_connection_sock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 741f0d96a7f7..f0f91858aecf 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -293,8 +293,8 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err)
293{ 293{
294 struct inet_connection_sock *icsk = inet_csk(sk); 294 struct inet_connection_sock *icsk = inet_csk(sk);
295 struct request_sock_queue *queue = &icsk->icsk_accept_queue; 295 struct request_sock_queue *queue = &icsk->icsk_accept_queue;
296 struct sock *newsk;
297 struct request_sock *req; 296 struct request_sock *req;
297 struct sock *newsk;
298 int error; 298 int error;
299 299
300 lock_sock(sk); 300 lock_sock(sk);
@@ -323,7 +323,9 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err)
323 newsk = req->sk; 323 newsk = req->sk;
324 324
325 sk_acceptq_removed(sk); 325 sk_acceptq_removed(sk);
326 if (sk->sk_protocol == IPPROTO_TCP && queue->fastopenq != NULL) { 326 if (sk->sk_protocol == IPPROTO_TCP &&
327 tcp_rsk(req)->tfo_listener &&
328 queue->fastopenq) {
327 spin_lock_bh(&queue->fastopenq->lock); 329 spin_lock_bh(&queue->fastopenq->lock);
328 if (tcp_rsk(req)->tfo_listener) { 330 if (tcp_rsk(req)->tfo_listener) {
329 /* We are still waiting for the final ACK from 3WHS 331 /* We are still waiting for the final ACK from 3WHS