Quantcast

[PATCH Yakkety SRU] net: use net->count to check whether a netns is alive or not

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH Yakkety SRU] net: use net->count to check whether a netns is alive or not

Tim Gardner-2
From: Andrey Vagin <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1672144

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 <[hidden email]>
Fixes: 002d8a1a6c11 ("net: skip genenerating uevents for network namespaces that are exiting")
Signed-off-by: Andrei Vagin <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from commit 91864f5852f9996210fad400cf70fb85af091243)
Signed-off-by: Tim Gardner <[hidden email]>

Conflicts:
        net/core/net-sysfs.c
---
 net/core/net-sysfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 6e4f347..dabd94c 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -950,6 +950,10 @@ net_rx_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
  }
 
  while (--i >= new_num) {
+ struct kobject *kobj = &dev->_rx[i].kobj;
+
+ if (!atomic_read(&dev_net(dev)->count))
+ kobj->uevent_suppress = 1;
  if (dev->sysfs_rx_queue_group)
  sysfs_remove_group(&dev->_rx[i].kobj,
    dev->sysfs_rx_queue_group);
@@ -1340,6 +1344,8 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
  while (--i >= new_num) {
  struct netdev_queue *queue = dev->_tx + i;
 
+ if (!atomic_read(&dev_net(dev)->count))
+ queue->kobj.uevent_suppress = 1;
 #ifdef CONFIG_BQL
  sysfs_remove_group(&queue->kobj, &dql_group);
 #endif
@@ -1525,6 +1531,9 @@ void netdev_unregister_kobject(struct net_device *ndev)
 {
  struct device *dev = &(ndev->dev);
 
+ if (!atomic_read(&dev_net(ndev)->count))
+ dev_set_uevent_suppress(dev, 1);
+
  kobject_get(&dev->kobj);
 
  remove_queue_kobjects(ndev);
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH Xenial/Yakkety SRU] net: use net->count to check whether a netns is alive or not

Tim Gardner-2
Also for Xenial


--
Tim Gardner [hidden email]

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH Yakkety SRU] net: use net->count to check whether a netns is alive or not

Joseph Salisbury-3
In reply to this post by Tim Gardner-2
Was this a backport versus a cherry-pick?

On 03/30/2017 07:28 PM, Tim Gardner wrote:

> From: Andrey Vagin <[hidden email]>
>
> BugLink: http://bugs.launchpad.net/bugs/1672144
>
> 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 <[hidden email]>
> Fixes: 002d8a1a6c11 ("net: skip genenerating uevents for network namespaces that are exiting")
> Signed-off-by: Andrei Vagin <[hidden email]>
> Signed-off-by: David S. Miller <[hidden email]>
> (cherry picked from commit 91864f5852f9996210fad400cf70fb85af091243)
> Signed-off-by: Tim Gardner <[hidden email]>
>
> Conflicts:
> net/core/net-sysfs.c
> ---
>  net/core/net-sysfs.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 6e4f347..dabd94c 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -950,6 +950,10 @@ net_rx_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
>   }
>  
>   while (--i >= new_num) {
> + struct kobject *kobj = &dev->_rx[i].kobj;
> +
> + if (!atomic_read(&dev_net(dev)->count))
> + kobj->uevent_suppress = 1;
>   if (dev->sysfs_rx_queue_group)
>   sysfs_remove_group(&dev->_rx[i].kobj,
>     dev->sysfs_rx_queue_group);
> @@ -1340,6 +1344,8 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
>   while (--i >= new_num) {
>   struct netdev_queue *queue = dev->_tx + i;
>  
> + if (!atomic_read(&dev_net(dev)->count))
> + queue->kobj.uevent_suppress = 1;
>  #ifdef CONFIG_BQL
>   sysfs_remove_group(&queue->kobj, &dql_group);
>  #endif
> @@ -1525,6 +1531,9 @@ void netdev_unregister_kobject(struct net_device *ndev)
>  {
>   struct device *dev = &(ndev->dev);
>  
> + if (!atomic_read(&dev_net(ndev)->count))
> + dev_set_uevent_suppress(dev, 1);
> +
>   kobject_get(&dev->kobj);
>  
>   remove_queue_kobjects(ndev);



--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH Yakkety SRU] net: use net->count to check whether a netns is alive or not

Tim Gardner-2
On 04/03/2017 05:09 PM, Joseph Salisbury wrote:
> Was this a backport versus a cherry-pick?
>

Indeed it was a backport.

rtg
--
Tim Gardner [hidden email]

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH X/Y SRU] net: use net->count to check whether a netns is alive or not

Tim Gardner-2
From: Andrey Vagin <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1672144

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 <[hidden email]>
Fixes: 002d8a1a6c11 ("net: skip genenerating uevents for network namespaces that are exiting")
Signed-off-by: Andrei Vagin <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(back ported from commit 91864f5852f9996210fad400cf70fb85af091243)
Signed-off-by: Tim Gardner <[hidden email]>

Conflicts:
        net/core/net-sysfs.c
---

V2 - noted that this is a back ported patch.

 net/core/net-sysfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index f88a62a..056b5ca 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -931,6 +931,10 @@ net_rx_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
  }
 
  while (--i >= new_num) {
+ struct kobject *kobj = &dev->_rx[i].kobj;
+
+ if (!atomic_read(&dev_net(dev)->count))
+ kobj->uevent_suppress = 1;
  if (dev->sysfs_rx_queue_group)
  sysfs_remove_group(&dev->_rx[i].kobj,
    dev->sysfs_rx_queue_group);
@@ -1321,6 +1325,8 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
  while (--i >= new_num) {
  struct netdev_queue *queue = dev->_tx + i;
 
+ if (!atomic_read(&dev_net(dev)->count))
+ queue->kobj.uevent_suppress = 1;
 #ifdef CONFIG_BQL
  sysfs_remove_group(&queue->kobj, &dql_group);
 #endif
@@ -1506,6 +1512,9 @@ void netdev_unregister_kobject(struct net_device *ndev)
 {
  struct device *dev = &(ndev->dev);
 
+ if (!atomic_read(&dev_net(ndev)->count))
+ dev_set_uevent_suppress(dev, 1);
+
  kobject_get(&dev->kobj);
 
  remove_queue_kobjects(ndev);
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [PATCH X/Y SRU] net: use net->count to check whether a netns is alive or not

Joseph Salisbury-3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [PATCH X/Y SRU] net: use net->count to check whether a netns is alive or not

Marcelo Cerri
In reply to this post by Tim Gardner-2
--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

APPLIED[XY/master-next]: [PATCH X/Y SRU] net: use net->count to check whether a netns is alive or not

Stefan Bader-2
In reply to this post by Tim Gardner-2



--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Loading...