[Devel] [PATCH rh7] ve/net: warn in case a Container hits ve::netif_max_nr

Konstantin Khorenko khorenko at virtuozzo.com
Fri Mar 1 18:14:02 MSK 2019


Without a warning it's tricky to findout the reason of
-ENOMEM on new network interface creation.

Warning is printed both on host and inside the Container.

https://jira.sw.ru/browse/PSBM-92132

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/core/dev.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index de584525fb2d..0437f7769c98 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7579,8 +7579,13 @@ int register_netdevice(struct net_device *dev)
 		goto out;
 
 	ret = -ENOMEM;
-	if (atomic_dec_if_positive(&net->owner_ve->netif_avail_nr) < 0)
+	if (atomic_dec_if_positive(&net->owner_ve->netif_avail_nr) < 0) {
+		ve_pr_warn_ratelimited(VE_LOG_BOTH,
+			"CT%s: hits max number of network devices, "
+			"increase ve::netif_max_nr parameter\n" ,
+			net->owner_ve->ve_name);
 		goto out;
+	}
 
 	spin_lock_init(&dev->addr_list_lock);
 	netdev_set_addr_lockdep_class(dev);
@@ -8437,8 +8442,13 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
 	}
 
 	err = -ENOMEM;
-	if (atomic_dec_if_positive(&net->owner_ve->netif_avail_nr) < 0)
+	if (atomic_dec_if_positive(&net->owner_ve->netif_avail_nr) < 0) {
+		ve_pr_warn_ratelimited(VE_LOG_BOTH,
+			"CT%s: hits max number of network devices, "
+			"increase ve::netif_max_nr parameter\n" ,
+			net->owner_ve->ve_name);
 		goto out;
+	}
 	atomic_inc(&dev_net(dev)->owner_ve->netif_avail_nr);
 
 	/*
-- 
2.15.1



More information about the Devel mailing list