netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] bonding: fix system hang due to fast igmp timer rescheduling
@ 2013-07-30 23:44 Nikolay Aleksandrov
  2013-08-01  0:05 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Aleksandrov @ 2013-07-30 23:44 UTC (permalink / raw)
  To: netdev; +Cc: andy, fubar, davem

From: "nikolay@redhat.com" <nikolay@redhat.com>

After commit 4aa5dee4d9 ("net: convert resend IGMP to notifier event")
we try to acquire rtnl in bond_resend_igmp_join_requests but it can be
scheduled with rtnl already held (e.g. when bond_change_active_slave is
called with rtnl) causing a loop of immediate reschedules + calls because
rtnl_trylock fails each time since it's being already held.
For me this issue leads to system hangs very easy:
modprobe bonding; ifconfig bond0 up; ifenslave bond0 eth0; rmmod
bonding;

The fix is to introduce a small (1 jiffy) delay which is enough for the
sections holding rtnl to finish without putting any strain on the system.
Also adjust the timer in bond_change_active_slave to be 1 jiffy, since
most of the time it's called with rtnl already held.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
v2: adjust bond_change_active_slave's mcast_work delay to 1 jiffy because
it's called with rtnl held most of the time as Jay suggested

 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index da3af63..bc3578e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -723,7 +723,7 @@ static int bond_set_allmulti(struct bonding *bond, int inc)
 static void bond_resend_igmp_join_requests(struct bonding *bond)
 {
 	if (!rtnl_trylock()) {
-		queue_delayed_work(bond->wq, &bond->mcast_work, 0);
+		queue_delayed_work(bond->wq, &bond->mcast_work, 1);
 		return;
 	}
 	call_netdevice_notifiers(NETDEV_RESEND_IGMP, bond->dev);
@@ -1084,7 +1084,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
 	    ((USES_PRIMARY(bond->params.mode) && new_active) ||
 	     bond->params.mode == BOND_MODE_ROUNDROBIN)) {
 		bond->igmp_retrans = bond->params.resend_igmp;
-		queue_delayed_work(bond->wq, &bond->mcast_work, 0);
+		queue_delayed_work(bond->wq, &bond->mcast_work, 1);
 	}
 }
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] bonding: fix system hang due to fast igmp timer rescheduling
  2013-07-30 23:44 [PATCH net-next v2] bonding: fix system hang due to fast igmp timer rescheduling Nikolay Aleksandrov
@ 2013-08-01  0:05 ` David Miller
  2013-08-01  7:45   ` Nikolay Aleksandrov
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2013-08-01  0:05 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, andy, fubar

From: Nikolay Aleksandrov <nikolay@redhat.com>
Date: Wed, 31 Jul 2013 01:44:06 +0200

> From: "nikolay@redhat.com" <nikolay@redhat.com>

I don't think that "nikolay@redhat.com" is your name. :-)

Please fix this up and resubmit, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] bonding: fix system hang due to fast igmp timer rescheduling
  2013-08-01  0:05 ` David Miller
@ 2013-08-01  7:45   ` Nikolay Aleksandrov
  0 siblings, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2013-08-01  7:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, andy, fubar

On 08/01/2013 02:05 AM, David Miller wrote:
> From: Nikolay Aleksandrov <nikolay@redhat.com>
> Date: Wed, 31 Jul 2013 01:44:06 +0200
> 
>> From: "nikolay@redhat.com" <nikolay@redhat.com>
> 
> I don't think that "nikolay@redhat.com" is your name. :-)
> 
> Please fix this up and resubmit, thanks.
> 
hehe nothing like a little git mess, will do. Thanks :-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-01  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-30 23:44 [PATCH net-next v2] bonding: fix system hang due to fast igmp timer rescheduling Nikolay Aleksandrov
2013-08-01  0:05 ` David Miller
2013-08-01  7:45   ` Nikolay Aleksandrov

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).