Skip to content

Commit

Permalink
bonding: Use msecs_to_jiffies, eliminate panic
Browse files Browse the repository at this point in the history
	Convert bonding to use msecs_to_jiffies instead of doing the
math.  For the ARP monitor, there was an underflow problem that could
result in an infinite loop.  The miimon already had that worked around,
but this is cleaner.

	Originally by Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
Jay Vosburgh corrected a math error in the original; Nicolas' original
commit message is:

When setting arp_interval parameter to a very low value, delta_in_ticks
for next arp might become 0, causing an infinite loop.

See http://bugzilla.kernel.org/show_bug.cgi?id=10680

Same problem for miimon parameter already fixed, but fix might be
enhanced, by using msecs_to_jiffies() function.

Signed-off-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Jay Vosburgh authored and Jeff Garzik committed May 22, 2008
1 parent d63ddce commit 5ce0da8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,7 @@ void bond_mii_monitor(struct work_struct *work)
read_lock(&bond->lock);
}

delay = ((bond->params.miimon * HZ) / 1000) ? : 1;
delay = msecs_to_jiffies(bond->params.miimon);
read_unlock(&bond->lock);
queue_delayed_work(bond->wq, &bond->mii_work, delay);
}
Expand Down Expand Up @@ -2707,7 +2707,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)

read_lock(&bond->lock);

delta_in_ticks = (bond->params.arp_interval * HZ) / 1000;
delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);

if (bond->kill_timers) {
goto out;
Expand Down Expand Up @@ -2837,7 +2837,7 @@ void bond_activebackup_arp_mon(struct work_struct *work)

read_lock(&bond->lock);

delta_in_ticks = (bond->params.arp_interval * HZ) / 1000;
delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);

if (bond->kill_timers) {
goto out;
Expand Down

0 comments on commit 5ce0da8

Please sign in to comment.