netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH net-next 4/8] net: use DEBUG_NET_WARN_ON_ONCE() in sk_stream_kill_queues()
Date: Tue,  7 Jun 2022 10:17:28 -0700	[thread overview]
Message-ID: <20220607171732.21191-5-eric.dumazet@gmail.com> (raw)
In-Reply-To: <20220607171732.21191-1-eric.dumazet@gmail.com>

From: Eric Dumazet <edumazet@google.com>

sk_stream_kill_queues() has three checks which have been
useful to detect kernel bugs in the past.

However they are potentially a problem because they
could flood the syslog, and really only a developper
can make sense of them.

Keep the checks for CONFIG_DEBUG_NET=y builds,
and issue them once only.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/stream.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/stream.c b/net/core/stream.c
index 06b36c730ce8a29bb2d8984495e780931907ca72..a5aa3620be95574c6d0f371f5943bb3b8f36cb4c 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -196,13 +196,13 @@ void sk_stream_kill_queues(struct sock *sk)
 	__skb_queue_purge(&sk->sk_receive_queue);
 
 	/* Next, the write queue. */
-	WARN_ON(!skb_queue_empty(&sk->sk_write_queue));
+	DEBUG_NET_WARN_ON_ONCE(!skb_queue_empty(&sk->sk_write_queue));
 
 	/* Account for returned memory. */
 	sk_mem_reclaim_final(sk);
 
-	WARN_ON(sk->sk_wmem_queued);
-	WARN_ON(sk->sk_forward_alloc);
+	DEBUG_NET_WARN_ON_ONCE(sk->sk_wmem_queued);
+	DEBUG_NET_WARN_ON_ONCE(sk->sk_forward_alloc);
 
 	/* It is _impossible_ for the backlog to contain anything
 	 * when we get here.  All user references to this socket
-- 
2.36.1.255.ge46751e96f-goog


  parent reply	other threads:[~2022-06-07 17:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 17:17 [PATCH net-next 0/8] net: few debug refinements Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 1/8] net: use DEBUG_NET_WARN_ON_ONCE() in __release_sock() Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 2/8] net: use DEBUG_NET_WARN_ON_ONCE() in dev_loopback_xmit() Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 3/8] net: use DEBUG_NET_WARN_ON_ONCE() in inet_sock_destruct() Eric Dumazet
2022-06-07 17:17 ` Eric Dumazet [this message]
2022-06-08  4:10   ` [PATCH net-next 4/8] net: use DEBUG_NET_WARN_ON_ONCE() in sk_stream_kill_queues() Jakub Kicinski
2022-06-08  8:11     ` Paolo Abeni
2022-06-08 15:25       ` Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 5/8] af_unix: use DEBUG_NET_WARN_ON_ONCE() Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 6/8] net: use DEBUG_NET_WARN_ON_ONCE() in skb_release_head_state() Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 7/8] net: add debug checks in napi_consume_skb and __napi_alloc_skb() Eric Dumazet
2022-06-07 17:17 ` [PATCH net-next 8/8] net: add napi_get_frags_check() helper Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220607171732.21191-5-eric.dumazet@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).