Patchwork [net,1/2] vxlan: unregister on namespace exit

login
register
mail settings
Submitter stephen hemminger
Date July 18, 2013, 3:38 p.m.
Message ID <20130718083826.58ae2b77@nehalam.linuxnetplumber.net>
Download mbox | patch
Permalink /patch/260082/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - July 18, 2013, 3:38 p.m.
Fix memory leaks and other badness from VXLAN network namespace
teardown. When network namespace is removed, all the vxlan devices should
be unregistered (not closed).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pravin B Shelar - July 18, 2013, 4:40 p.m.
On Thu, Jul 18, 2013 at 8:38 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> Fix memory leaks and other badness from VXLAN network namespace
> teardown. When network namespace is removed, all the vxlan devices should
> be unregistered (not closed).
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
>
> --- a/drivers/net/vxlan.c       2013-07-17 16:32:10.826955800 -0700
> +++ b/drivers/net/vxlan.c       2013-07-17 16:47:35.275690741 -0700
> @@ -1878,10 +1878,12 @@ static __net_exit void vxlan_exit_net(st
>  {
>         struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>         struct vxlan_dev *vxlan;
> +       LIST_HEAD(list);
>
>         rtnl_lock();
> -       list_for_each_entry(vxlan, &vn->vxlan_list, next)
> -               dev_close(vxlan->dev);
> +       list_for_each_entry(vxlan, &vn->vxlan_list, next)
> +               unregister_netdevice_queue(vxlan->dev, &list);
> +       unregister_netdevice_many(&list);
>         rtnl_unlock();
>  }
>
Looks good.
Reviewed-by: Pravin B Shelar <pshelar@nicira.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
stephen hemminger - July 18, 2013, 4:58 p.m.
On Thu, 18 Jul 2013 09:40:07 -0700
Pravin Shelar <pshelar@nicira.com> wrote:

> On Thu, Jul 18, 2013 at 8:38 AM, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > Fix memory leaks and other badness from VXLAN network namespace
> > teardown. When network namespace is removed, all the vxlan devices should
> > be unregistered (not closed).
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> >
> >
> > --- a/drivers/net/vxlan.c       2013-07-17 16:32:10.826955800 -0700
> > +++ b/drivers/net/vxlan.c       2013-07-17 16:47:35.275690741 -0700
> > @@ -1878,10 +1878,12 @@ static __net_exit void vxlan_exit_net(st
> >  {
> >         struct vxlan_net *vn = net_generic(net, vxlan_net_id);
> >         struct vxlan_dev *vxlan;
> > +       LIST_HEAD(list);
> >
> >         rtnl_lock();
> > -       list_for_each_entry(vxlan, &vn->vxlan_list, next)
> > -               dev_close(vxlan->dev);
> > +       list_for_each_entry(vxlan, &vn->vxlan_list, next)
> > +               unregister_netdevice_queue(vxlan->dev, &list);
> > +       unregister_netdevice_many(&list);
> >         rtnl_unlock();
> >  }
> >
> Looks good.
> Reviewed-by: Pravin B Shelar <pshelar@nicira.com>

vxlan might be a candidate for integration with the generic ip_tunnel
code, but haven't looked at all the details.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pravin B Shelar - July 18, 2013, 6:28 p.m.
On Thu, Jul 18, 2013 at 9:58 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Thu, 18 Jul 2013 09:40:07 -0700
> Pravin Shelar <pshelar@nicira.com> wrote:
>
>> On Thu, Jul 18, 2013 at 8:38 AM, Stephen Hemminger
>> <stephen@networkplumber.org> wrote:
>> > Fix memory leaks and other badness from VXLAN network namespace
>> > teardown. When network namespace is removed, all the vxlan devices should
>> > be unregistered (not closed).
>> >
>> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>> >
>> >
>> > --- a/drivers/net/vxlan.c       2013-07-17 16:32:10.826955800 -0700
>> > +++ b/drivers/net/vxlan.c       2013-07-17 16:47:35.275690741 -0700
>> > @@ -1878,10 +1878,12 @@ static __net_exit void vxlan_exit_net(st
>> >  {
>> >         struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>> >         struct vxlan_dev *vxlan;
>> > +       LIST_HEAD(list);
>> >
>> >         rtnl_lock();
>> > -       list_for_each_entry(vxlan, &vn->vxlan_list, next)
>> > -               dev_close(vxlan->dev);
>> > +       list_for_each_entry(vxlan, &vn->vxlan_list, next)
>> > +               unregister_netdevice_queue(vxlan->dev, &list);
>> > +       unregister_netdevice_many(&list);
>> >         rtnl_unlock();
>> >  }
>> >
>> Looks good.
>> Reviewed-by: Pravin B Shelar <pshelar@nicira.com>
>
> vxlan might be a candidate for integration with the generic ip_tunnel
> code, but haven't looked at all the details.

ip_tunnel already does same on net-exit.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - July 18, 2013, 8:15 p.m.
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 18 Jul 2013 08:38:26 -0700

> Fix memory leaks and other badness from VXLAN network namespace
> teardown. When network namespace is removed, all the vxlan devices should
> be unregistered (not closed).
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/drivers/net/vxlan.c	2013-07-17 16:32:10.826955800 -0700
+++ b/drivers/net/vxlan.c	2013-07-17 16:47:35.275690741 -0700
@@ -1878,10 +1878,12 @@  static __net_exit void vxlan_exit_net(st
 {
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_dev *vxlan;
+	LIST_HEAD(list);
 
 	rtnl_lock();
-	list_for_each_entry(vxlan, &vn->vxlan_list, next)
-		dev_close(vxlan->dev);
+	list_for_each_entry(vxlan, &vn->vxlan_list, next)
+		unregister_netdevice_queue(vxlan->dev, &list);
+	unregister_netdevice_many(&list);
 	rtnl_unlock();
 }