Commit f5703759 authored by Peter Oskolkov's avatar Peter Oskolkov Committed by Dong Chenchen
Browse files

net: add a route cache full diagnostic message

stable inclusion
from stable-v4.19.304
commit 47468fae2704151503214f4d4327c164118247fd
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I90HST

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=47468fae2704151503214f4d4327c164118247fd



--------------------------------

commit 22c2ad61 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: default avatarPeter Oskolkov <posk@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSuraj Jitindar Singh <surajjs@amazon.com>
Cc: <stable@vger.kernel.org> # 4.19.x
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
parent 0ec2c5ee
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -98,9 +98,13 @@ 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);
	if (!dst)