* Cannot delete a bridge using 'ip' netlink interface
@ 2011-10-06 17:18 Sridhar Samudrala
2011-10-06 21:19 ` [PATCH] bridge: fix hang on removal of bridge via netlink Stephen Hemminger
2011-10-07 20:37 ` Cannot delete a bridge using 'ip' netlink interface Michael Tokarev
0 siblings, 2 replies; 6+ messages in thread
From: Sridhar Samudrala @ 2011-10-06 17:18 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On a linux 3.1.0-rc9 system using the latest iproute2, i tried
creating a bridge and deleting it with an attached interface.
Here is the sequence of steps i tried
ip link add br0 type bridge
ip link set dev eth1 master br0
ip link set br0 up
ip link del br0
The last command hangs with the following kernel messages
kernel:unregister_netdevice: waiting for br0 to become free. Usage count = 1
I see the same behavior even if the bridge is brought down
before trying to delete the bridge.
brctl delbr fails with an error message if the bridge is up.
But it succeeds if the bridge is brought down before doing a delbr
even if it has interfaces attached.
Thanks
Sridhar
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] bridge: fix hang on removal of bridge via netlink
2011-10-06 17:18 Cannot delete a bridge using 'ip' netlink interface Sridhar Samudrala
@ 2011-10-06 21:19 ` Stephen Hemminger
2011-10-06 23:02 ` Sridhar Samudrala
2011-10-07 20:37 ` Cannot delete a bridge using 'ip' netlink interface Michael Tokarev
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2011-10-06 21:19 UTC (permalink / raw)
To: Sridhar Samudrala, David Miller; +Cc: netdev
Need to cleanup bridge device timers and ports when being bridge
device is being removed via netlink.
This fixes the problem of observed when doing:
ip link add br0 type bridge
ip link set dev eth1 master br0
ip link set br0 up
ip link del br0
which would cause br0 to hang in unregister_netdev because
of leftover reference count.
Reported-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
Patch is against net-next but should go to net and stable trees
since it is an observable hang on 3.0 and later kernels.
--- a/net/bridge/br_if.c 2011-10-03 11:08:36.304168386 -0700
+++ b/net/bridge/br_if.c 2011-10-06 11:27:47.682488755 -0700
@@ -160,9 +160,10 @@ static void del_nbp(struct net_bridge_po
call_rcu(&p->rcu, destroy_nbp_rcu);
}
-/* called with RTNL */
-static void del_br(struct net_bridge *br, struct list_head *head)
+/* Delete bridge device */
+void br_dev_delete(struct net_device *dev, struct list_head *head)
{
+ struct net_bridge *br = netdev_priv(dev);
struct net_bridge_port *p, *n;
list_for_each_entry_safe(p, n, &br->port_list, list) {
@@ -267,7 +268,7 @@ int br_del_bridge(struct net *net, const
}
else
- del_br(netdev_priv(dev), NULL);
+ br_dev_delete(dev, NULL);
rtnl_unlock();
return ret;
@@ -446,7 +447,7 @@ void __net_exit br_net_exit(struct net *
rtnl_lock();
for_each_netdev(net, dev)
if (dev->priv_flags & IFF_EBRIDGE)
- del_br(netdev_priv(dev), &list);
+ br_dev_delete(dev, &list);
unregister_netdevice_many(&list);
rtnl_unlock();
--- a/net/bridge/br_netlink.c 2011-09-16 13:12:58.061369744 -0700
+++ b/net/bridge/br_netlink.c 2011-10-06 11:20:21.808911679 -0700
@@ -210,6 +210,7 @@ static struct rtnl_link_ops br_link_ops
.priv_size = sizeof(struct net_bridge),
.setup = br_dev_setup,
.validate = br_validate,
+ .dellink = br_dev_delete,
};
int __init br_netlink_init(void)
--- a/net/bridge/br_private.h 2011-10-06 08:42:27.353044954 -0700
+++ b/net/bridge/br_private.h 2011-10-06 11:25:17.845118817 -0700
@@ -301,6 +301,7 @@ static inline int br_is_root_bridge(cons
/* br_device.c */
extern void br_dev_setup(struct net_device *dev);
+extern void br_dev_delete(struct net_device *dev, struct list_head *list);
extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
struct net_device *dev);
#ifdef CONFIG_NET_POLL_CONTROLLER
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge: fix hang on removal of bridge via netlink
2011-10-06 21:19 ` [PATCH] bridge: fix hang on removal of bridge via netlink Stephen Hemminger
@ 2011-10-06 23:02 ` Sridhar Samudrala
2011-10-19 3:24 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Sridhar Samudrala @ 2011-10-06 23:02 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
On Thu, 2011-10-06 at 14:19 -0700, Stephen Hemminger wrote:
> Need to cleanup bridge device timers and ports when being bridge
> device is being removed via netlink.
>
> This fixes the problem of observed when doing:
> ip link add br0 type bridge
> ip link set dev eth1 master br0
> ip link set br0 up
> ip link del br0
>
> which would cause br0 to hang in unregister_netdev because
> of leftover reference count.
>
> Reported-by: Sridhar Samudrala <sri@us.ibm.com>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Sridhar Samudrala <sri@us.ibm.com>
>
> ---
> Patch is against net-next but should go to net and stable trees
> since it is an observable hang on 3.0 and later kernels.
>
> --- a/net/bridge/br_if.c 2011-10-03 11:08:36.304168386 -0700
> +++ b/net/bridge/br_if.c 2011-10-06 11:27:47.682488755 -0700
> @@ -160,9 +160,10 @@ static void del_nbp(struct net_bridge_po
> call_rcu(&p->rcu, destroy_nbp_rcu);
> }
>
> -/* called with RTNL */
> -static void del_br(struct net_bridge *br, struct list_head *head)
> +/* Delete bridge device */
> +void br_dev_delete(struct net_device *dev, struct list_head *head)
> {
> + struct net_bridge *br = netdev_priv(dev);
> struct net_bridge_port *p, *n;
>
> list_for_each_entry_safe(p, n, &br->port_list, list) {
> @@ -267,7 +268,7 @@ int br_del_bridge(struct net *net, const
> }
>
> else
> - del_br(netdev_priv(dev), NULL);
> + br_dev_delete(dev, NULL);
>
> rtnl_unlock();
> return ret;
> @@ -446,7 +447,7 @@ void __net_exit br_net_exit(struct net *
> rtnl_lock();
> for_each_netdev(net, dev)
> if (dev->priv_flags & IFF_EBRIDGE)
> - del_br(netdev_priv(dev), &list);
> + br_dev_delete(dev, &list);
>
> unregister_netdevice_many(&list);
> rtnl_unlock();
> --- a/net/bridge/br_netlink.c 2011-09-16 13:12:58.061369744 -0700
> +++ b/net/bridge/br_netlink.c 2011-10-06 11:20:21.808911679 -0700
> @@ -210,6 +210,7 @@ static struct rtnl_link_ops br_link_ops
> .priv_size = sizeof(struct net_bridge),
> .setup = br_dev_setup,
> .validate = br_validate,
> + .dellink = br_dev_delete,
> };
>
> int __init br_netlink_init(void)
> --- a/net/bridge/br_private.h 2011-10-06 08:42:27.353044954 -0700
> +++ b/net/bridge/br_private.h 2011-10-06 11:25:17.845118817 -0700
> @@ -301,6 +301,7 @@ static inline int br_is_root_bridge(cons
>
> /* br_device.c */
> extern void br_dev_setup(struct net_device *dev);
> +extern void br_dev_delete(struct net_device *dev, struct list_head *list);
> extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
> struct net_device *dev);
> #ifdef CONFIG_NET_POLL_CONTROLLER
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Cannot delete a bridge using 'ip' netlink interface
2011-10-06 17:18 Cannot delete a bridge using 'ip' netlink interface Sridhar Samudrala
2011-10-06 21:19 ` [PATCH] bridge: fix hang on removal of bridge via netlink Stephen Hemminger
@ 2011-10-07 20:37 ` Michael Tokarev
2011-10-07 21:22 ` Michael Tokarev
1 sibling, 1 reply; 6+ messages in thread
From: Michael Tokarev @ 2011-10-07 20:37 UTC (permalink / raw)
To: Sridhar Samudrala; +Cc: Stephen Hemminger, netdev
On 06.10.2011 21:18, Sridhar Samudrala wrote:
> On a linux 3.1.0-rc9 system using the latest iproute2, i tried
> creating a bridge and deleting it with an attached interface.
>
> Here is the sequence of steps i tried
> ip link add br0 type bridge
> ip link set dev eth1 master br0
> ip link set br0 up
> ip link del br0
>
> The last command hangs with the following kernel messages
> kernel:unregister_netdevice: waiting for br0 to become free. Usage count = 1
Note that the same thing happens when one tries to rmmod bridge
while it is in use. I'm trying your patch to see if that helps... ;)
/mjt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Cannot delete a bridge using 'ip' netlink interface
2011-10-07 20:37 ` Cannot delete a bridge using 'ip' netlink interface Michael Tokarev
@ 2011-10-07 21:22 ` Michael Tokarev
0 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2011-10-07 21:22 UTC (permalink / raw)
To: Sridhar Samudrala; +Cc: Stephen Hemminger, netdev
On 08.10.2011 00:37, Michael Tokarev wrote:
> On 06.10.2011 21:18, Sridhar Samudrala wrote:
>> On a linux 3.1.0-rc9 system using the latest iproute2, i tried
>> creating a bridge and deleting it with an attached interface.
>>
>> Here is the sequence of steps i tried
>> ip link add br0 type bridge
>> ip link set dev eth1 master br0
>> ip link set br0 up
>> ip link del br0
>>
>> The last command hangs with the following kernel messages
>> kernel:unregister_netdevice: waiting for br0 to become free. Usage count = 1
>
> Note that the same thing happens when one tries to rmmod bridge
> while it is in use. I'm trying your patch to see if that helps... ;)
..And with the patch sent in this thread, bridge module can be
removed and inserted again with proper cleanup.
So you can add my
Tested-Off-By: Michael Tokarev <mjt@tls.msk.ru>
too, if necessary :)
Thanks,
/mjt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge: fix hang on removal of bridge via netlink
2011-10-06 23:02 ` Sridhar Samudrala
@ 2011-10-19 3:24 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-10-19 3:24 UTC (permalink / raw)
To: sri; +Cc: shemminger, netdev
From: Sridhar Samudrala <sri@us.ibm.com>
Date: Thu, 06 Oct 2011 16:02:49 -0700
> On Thu, 2011-10-06 at 14:19 -0700, Stephen Hemminger wrote:
>> Need to cleanup bridge device timers and ports when being bridge
>> device is being removed via netlink.
>>
>> This fixes the problem of observed when doing:
>> ip link add br0 type bridge
>> ip link set dev eth1 master br0
>> ip link set br0 up
>> ip link del br0
>>
>> which would cause br0 to hang in unregister_netdev because
>> of leftover reference count.
>>
>> Reported-by: Sridhar Samudrala <sri@us.ibm.com>
>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Acked-by: Sridhar Samudrala <sri@us.ibm.com>
Applied to 'net' and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-19 3:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-06 17:18 Cannot delete a bridge using 'ip' netlink interface Sridhar Samudrala
2011-10-06 21:19 ` [PATCH] bridge: fix hang on removal of bridge via netlink Stephen Hemminger
2011-10-06 23:02 ` Sridhar Samudrala
2011-10-19 3:24 ` David Miller
2011-10-07 20:37 ` Cannot delete a bridge using 'ip' netlink interface Michael Tokarev
2011-10-07 21:22 ` Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).