tcp: use limited socket backlog
authorZhu Yi <yi.zhu@intel.com>
Thu, 4 Mar 2010 18:01:41 +0000 (18:01 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Mar 2010 21:34:00 +0000 (13:34 -0800)
Make tcp adapt to the limited socket backlog change.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c

index c3588b4fd9798bcfa0c1fdf62ba2f2586136d441..4baf1943b1bd89c4b057622948e3eb899984138c 100644 (file)
@@ -1682,8 +1682,10 @@ process:
                        if (!tcp_prequeue(sk, skb))
                                ret = tcp_v4_do_rcv(sk, skb);
                }
-       } else
-               sk_add_backlog(sk, skb);
+       } else if (sk_add_backlog_limited(sk, skb)) {
+               bh_unlock_sock(sk);
+               goto discard_and_relse;
+       }
        bh_unlock_sock(sk);
 
        sock_put(sk);
index 6963a6b6763e74f8aca6e95888bcd62793b89745..c4ea9d5cbfaaad9740df03e8aeecf80f777c6648 100644 (file)
@@ -1740,8 +1740,10 @@ process:
                        if (!tcp_prequeue(sk, skb))
                                ret = tcp_v6_do_rcv(sk, skb);
                }
-       } else
-               sk_add_backlog(sk, skb);
+       } else if (sk_add_backlog_limited(sk, skb)) {
+               bh_unlock_sock(sk);
+               goto discard_and_relse;
+       }
        bh_unlock_sock(sk);
 
        sock_put(sk);