public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Suraj Jitindar Singh <surajjs@amazon.com>
To: <stable@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <trawets@amazon.com>,
	<security@kernel.org>, Peter Oskolkov <posk@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Suraj Jitindar Singh <surajjs@amazon.com>
Subject: [PATCH stable 4.19.x 1/4] net: add a route cache full diagnostic message
Date: Fri, 12 Jan 2024 16:53:05 -0800	[thread overview]
Message-ID: <20240113005308.2422331-1-surajjs@amazon.com> (raw)
In-Reply-To: <2024011155-gruffly-chunk-e186@gregkh>

From: Peter Oskolkov <posk@google.com>

commit 22c2ad616b74f3de2256b242572ab449d031d941 upstream.

In some testing scenarios, dst/route cache can fill up so quickly
that even an explicit GC call occasionally fails to clean it up. This leads
to sporadically failing calls to dst_alloc and "network unreachable" errors
to the user, which is confusing.

This patch adds a diagnostic message to make the cause of the failure
easier to determine.

Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
Cc: <stable@vger.kernel.org> # 4.19.x
---
 net/core/dst.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index 81ccf20e2826..a263309df115 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -98,8 +98,12 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
 	struct dst_entry *dst;
 
 	if (ops->gc && dst_entries_get_fast(ops) > ops->gc_thresh) {
-		if (ops->gc(ops))
+		if (ops->gc(ops)) {
+			printk_ratelimited(KERN_NOTICE "Route cache is full: "
+					   "consider increasing sysctl "
+					   "net.ipv[4|6].route.max_size.\n");
 			return NULL;
+		}
 	}
 
 	dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC);
-- 
2.34.1


  parent reply	other threads:[~2024-01-13  0:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2024011155-gruffly-chunk-e186@gregkh>
2024-01-13  0:42 ` [PATCH stable 5.4.x 1/3] net/dst: use a smaller percpu_counter batch for dst entries accounting Suraj Jitindar Singh
2024-01-13  0:42   ` [PATCH stable 5.4.x 2/3] ipv6: make ip6_rt_gc_expire an atomic_t Suraj Jitindar Singh
2024-01-13  0:42   ` [PATCH stable 5.4.x 3/3] ipv6: remove max_size check inline with ipv4 Suraj Jitindar Singh
2024-01-13  0:53 ` Suraj Jitindar Singh [this message]
2024-01-13  0:53   ` [PATCH stable 4.19.x 2/4] net/dst: use a smaller percpu_counter batch for dst entries accounting Suraj Jitindar Singh
2024-01-13  0:53   ` [PATCH stable 4.19.x 3/4] ipv6: make ip6_rt_gc_expire an atomic_t Suraj Jitindar Singh
2024-01-13  0:53   ` [PATCH stable 4.19.x 4/4] ipv6: remove max_size check inline with ipv4 Suraj Jitindar Singh
2024-01-13  9:19   ` [PATCH stable 4.19.x 1/4] net: add a route cache full diagnostic message Greg KH

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=20240113005308.2422331-1-surajjs@amazon.com \
    --to=surajjs@amazon.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=posk@google.com \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=trawets@amazon.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