netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch]  bondig - arp_interval with low value => Oops.
@ 2008-05-15 20:34 Nicolas 2P
  2008-05-17 20:20 ` Joe Eykholt
  2008-06-10 22:19 ` Jeff Garzik
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas 2P @ 2008-05-15 20:34 UTC (permalink / raw)
  To: Jay Vosburgh, David Miller, bonding-devel, linux-net,
	linux-kernel, netdev

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>

--- /usr/src/linux/drivers/net/bonding/bond_main_orig.c 2008-05-13 
02:00:01.000000000 +0200
+++ /usr/src/linux/drivers/net/bonding/bond_main.c      2008-05-14 
14:55:53.000000000 +0200
@@ -2391,7 +2391,7 @@
                 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);
  }
@@ -2704,7 +2704,7 @@

         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;
@@ -2837,7 +2837,7 @@

         read_lock(&bond->lock);

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

         if (bond->kill_timers) {
                 goto out;

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

* Re: [patch]  bondig - arp_interval with low value => Oops.
  2008-05-15 20:34 [patch] bondig - arp_interval with low value => Oops Nicolas 2P
@ 2008-05-17 20:20 ` Joe Eykholt
  2008-05-18  3:39   ` [Bonding-devel] " Jay Vosburgh
  2008-06-10 22:19 ` Jeff Garzik
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Eykholt @ 2008-05-17 20:20 UTC (permalink / raw)
  To: Nicolas 2P
  Cc: Jay Vosburgh, David Miller, bonding-devel, linux-net,
	linux-kernel, netdev

Nicolas 2P wrote:
> 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>
> 
> --- /usr/src/linux/drivers/net/bonding/bond_main_orig.c 2008-05-13 
> 02:00:01.000000000 +0200
> +++ /usr/src/linux/drivers/net/bonding/bond_main.c      2008-05-14 
> 14:55:53.000000000 +0200
> @@ -2391,7 +2391,7 @@
>                 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);
>  }
> @@ -2704,7 +2704,7 @@
> 
>         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;
> @@ -2837,7 +2837,7 @@
> 
>         read_lock(&bond->lock);
> 
> -       delta_in_ticks = (bond->params.arp_interval * HZ) / 1000;
> +       delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval * HZ);

This seems like it should be just:

	delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);

Assuming the interval is in milliseconds, based on the previous usage.
Since it's multiplying by HZ (ticks per second) and dividing by 1000 
(milliseconds per second), it was converting from milliseconds to ticks.

Same for the other changes?

	Joe

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

* Re: [Bonding-devel] [patch] bondig - arp_interval with low value => Oops.
  2008-05-17 20:20 ` Joe Eykholt
@ 2008-05-18  3:39   ` Jay Vosburgh
  0 siblings, 0 replies; 6+ messages in thread
From: Jay Vosburgh @ 2008-05-18  3:39 UTC (permalink / raw)
  To: Joe Eykholt
  Cc: Nicolas 2P, netdev, linux-kernel, bonding-devel, linux-net,
	David Miller

Joe Eykholt <jre@nuovasystems.com> wrote:

>Nicolas 2P wrote:
[...]
>> @@ -2837,7 +2837,7 @@
>> 
>>         read_lock(&bond->lock);
>> 
>> -       delta_in_ticks = (bond->params.arp_interval * HZ) / 1000;
>> +       delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval * HZ);
>
>This seems like it should be just:
>
>	delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);

	Yes.  I've corrected this already in my copy (which I'll be
posting momentarily).

>Same for the other changes?

	The other two instances were correct, only the last change had
the extra "* HZ".

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

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

* Re: [patch]  bondig - arp_interval with low value => Oops.
  2008-05-15 20:34 [patch] bondig - arp_interval with low value => Oops Nicolas 2P
  2008-05-17 20:20 ` Joe Eykholt
@ 2008-06-10 22:19 ` Jeff Garzik
  2008-06-10 22:30   ` Jay Vosburgh
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2008-06-10 22:19 UTC (permalink / raw)
  To: Nicolas 2P
  Cc: Jay Vosburgh, David Miller, bonding-devel, linux-net,
	linux-kernel, netdev

Nicolas 2P wrote:
> 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>

I don't see an ACK from Jay in my mbox?

Certainly looks nicer than adding "? : 1" to each of the remaining two 
cases.



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

* Re: [patch] bondig - arp_interval with low value => Oops.
  2008-06-10 22:19 ` Jeff Garzik
@ 2008-06-10 22:30   ` Jay Vosburgh
  2008-06-10 22:39     ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Jay Vosburgh @ 2008-06-10 22:30 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Nicolas 2P, David Miller, bonding-devel, linux-net, linux-kernel,
	netdev

Jeff Garzik <jeff@garzik.org> wrote:

>Nicolas 2P wrote:
>> 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>
>
>I don't see an ACK from Jay in my mbox?
>
>Certainly looks nicer than adding "? : 1" to each of the remaining two
>cases.

	This was accepted a couple of weeks ago; I had to fix a bug in
the patch, so I'd guess you didn't connect them:

commit 5ce0da8f0386b62345312ec8fed31303732f4220
Author: Jay Vosburgh <fubar@us.ibm.com>
Date:   Sat May 17 21:10:07 2008 -0700

    bonding: Use msecs_to_jiffies, eliminate panic
    
        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>


	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

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

* Re: [patch] bondig - arp_interval with low value => Oops.
  2008-06-10 22:30   ` Jay Vosburgh
@ 2008-06-10 22:39     ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2008-06-10 22:39 UTC (permalink / raw)
  To: Jay Vosburgh
  Cc: Nicolas 2P, David Miller, bonding-devel, linux-net, linux-kernel,
	netdev

Jay Vosburgh wrote:
> Jeff Garzik <jeff@garzik.org> wrote:
> 
>> Nicolas 2P wrote:
>>> 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>
>> I don't see an ACK from Jay in my mbox?
>>
>> Certainly looks nicer than adding "? : 1" to each of the remaining two
>> cases.
> 
> 	This was accepted a couple of weeks ago; I had to fix a bug in
> the patch, so I'd guess you didn't connect them:
> 
> commit 5ce0da8f0386b62345312ec8fed31303732f4220
> Author: Jay Vosburgh <fubar@us.ibm.com>
> Date:   Sat May 17 21:10:07 2008 -0700
> 
>     bonding: Use msecs_to_jiffies, eliminate panic

Great, thanks!



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

end of thread, other threads:[~2008-06-10 22:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15 20:34 [patch] bondig - arp_interval with low value => Oops Nicolas 2P
2008-05-17 20:20 ` Joe Eykholt
2008-05-18  3:39   ` [Bonding-devel] " Jay Vosburgh
2008-06-10 22:19 ` Jeff Garzik
2008-06-10 22:30   ` Jay Vosburgh
2008-06-10 22:39     ` Jeff Garzik

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