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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Mar 4 15:31:21 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.5.1.vz7.84.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.5.1.vz7.84.2
------>
commit 0925ea68bf568cf53dc2ef4023e3bfb74769059e
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Mar 1 18:11:11 2019 +0300

    ve/net: warn in case a Container hits ve::netif_max_nr
    
    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);
 
 	/*



More information about the Devel mailing list