From patchwork Mon Jul 11 08:17:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 104173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id A56F3B70D6 for ; Mon, 11 Jul 2011 18:18:11 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1QgBgm-0007bY-JK; Mon, 11 Jul 2011 08:18:00 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1QgBgk-0007a3-38 for kernel-team@lists.ubuntu.com; Mon, 11 Jul 2011 08:17:58 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QgBgk-0000Ez-0X for ; Mon, 11 Jul 2011 08:17:58 +0000 Received: from dynamic-adsl-94-36-117-159.clienti.tiscali.it ([94.36.117.159] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1QgBgj-0000h3-On for kernel-team@lists.ubuntu.com; Mon, 11 Jul 2011 08:17:57 +0000 From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 05/11] udp: multicast RX should increment SNMP/sk_drops counter in allocation failures Date: Mon, 11 Jul 2011 10:17:42 +0200 Message-Id: <1310372268-3840-6-git-send-email-paolo.pisati@canonical.com> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1310372268-3840-1-git-send-email-paolo.pisati@canonical.com> References: <1310372268-3840-1-git-send-email-paolo.pisati@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Eric Dumazet BugLink: http://bugs.launchpad.net/bugs/807462 commit upstream f6b8f32ca71406de718391369490f6b1e81fe0bb (patch necessary for 6ed41136ab20c99d47792b3f19171ab9e523a97f) When skb_clone() fails, we should increment sk_drops and SNMP counters. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Paolo Pisati --- net/ipv4/udp.c | 12 +++++++++++- net/ipv6/udp.c | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 6a39004..595144d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1192,12 +1192,22 @@ static void flush_stack(struct sock **stack, unsigned int count, { unsigned int i; struct sk_buff *skb1 = NULL; + struct sock *sk; for (i = 0; i < count; i++) { + sk = stack[i]; if (likely(skb1 == NULL)) skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC); - if (skb1 && udp_queue_rcv_skb(stack[i], skb1) <= 0) + if (!skb1) { + atomic_inc(&sk->sk_drops); + UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, + IS_UDPLITE(sk)); + UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, + IS_UDPLITE(sk)); + } + + if (skb1 && udp_queue_rcv_skb(sk, skb1) <= 0) skb1 = NULL; } if (unlikely(skb1)) diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index ede7a73..6fe1846 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -450,14 +450,20 @@ static void flush_stack(struct sock **stack, unsigned int count, for (i = 0; i < count; i++) { skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC); + sk = stack[i]; if (skb1) { - sk = stack[i]; bh_lock_sock(sk); if (!sock_owned_by_user(sk)) udpv6_queue_rcv_skb(sk, skb1); else sk_add_backlog(sk, skb1); bh_unlock_sock(sk); + } else { + atomic_inc(&sk->sk_drops); + UDP6_INC_STATS_BH(sock_net(sk), + UDP_MIB_RCVBUFERRORS, IS_UDPLITE(sk)); + UDP6_INC_STATS_BH(sock_net(sk), + UDP_MIB_INERRORS, IS_UDPLITE(sk)); } } }