Skip to content

Commit

Permalink
net: add a route cache full diagnostic message
Browse files Browse the repository at this point in the history
commit 22c2ad6 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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Oskolkov authored and Greg Kroah-Hartman committed Jan 15, 2024
1 parent 610003d commit 47468fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/core/dst.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 47468fa

Please sign in to comment.