[Devel] [PATCH RHEL7 COMMIT] ms/net: use net->count to check whether a netns is alive or not
Konstantin Khorenko
khorenko at virtuozzo.com
Wed May 27 19:14:00 MSK 2020
The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.161.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.161.2
------>
commit 4378303981ce5b626ae50275e8f39588fb13d2f9
Author: Andrey Vagin <avagin at openvz.org>
Date: Sun Mar 12 21:36:18 2017 -0700
ms/net: use net->count to check whether a netns is alive or not
The previous idea was to check whether a net namespace is in
net_exit_list or not. It doesn't work, because net->exit_list is used in
__register_pernet_operations and __unregister_pernet_operations where
all namespaces are added to a temporary list to make cleanup in a error
case, so list_empty(&net->exit_list) always returns false.
Reported-by: Mantas MikulÄnas <grawity at gmail.com>
Fixes: 002d8a1a6c11 ("net: skip genenerating uevents for network namespaces that are exiting")
Signed-off-by: Andrei Vagin <avagin at openvz.org>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 91864f5852f9996210fad400cf70fb85af091243)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
net/core/net-sysfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 52199cb62bd22..18463b0a4a1e4 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -920,7 +920,7 @@ net_rx_queue_update_kobjects(struct net_device *net, int old_num, int new_num)
while (--i >= new_num) {
struct kobject *kobj = &net->_rx[i].kobj;
- if (!list_empty(&dev_net(net)->exit_list))
+ if (!atomic_read(&dev_net(net)->count))
kobj->uevent_suppress = 1;
kobject_put(kobj);
@@ -1337,7 +1337,7 @@ netdev_queue_update_kobjects(struct net_device *net, int old_num, int new_num)
while (--i >= new_num) {
struct netdev_queue *queue = net->_tx + i;
- if (!list_empty(&dev_net(net)->exit_list))
+ if (!atomic_read(&dev_net(net)->count))
queue->kobj.uevent_suppress = 1;
#ifdef CONFIG_BQL
sysfs_remove_group(&queue->kobj, &dql_group);
@@ -1497,7 +1497,7 @@ void netdev_unregister_kobject(struct net_device * net)
{
struct device *dev = &(net->dev);
- if (!list_empty(&dev_net(net)->exit_list))
+ if (!atomic_read(&dev_net(net)->count))
dev_set_uevent_suppress(dev, 1);
kobject_get(&dev->kobj);
More information about the Devel
mailing list