[NET] link_watch: Eliminate potential delay on wrap-around
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 9 May 2007 06:22:43 +0000 (23:22 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 11 May 2007 06:45:11 +0000 (23:45 -0700)
When the jiffies wrap around or when the system boots up for the first
time, down events can be delayed indefinitely since we no longer
update linkwatch_nextevent when only urgent events are processed.

This patch fixes this by setting linkwatch_nextevent when a
wrap-around occurs.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/link_watch.c

index b5f45799c2f3905300fac9d4eb061cae89534731..4674ae574128e3c4838d1c5076ac7b074c77b5bd 100644 (file)
@@ -101,8 +101,10 @@ static void linkwatch_schedule_work(unsigned long delay)
                return;
 
        /* If we wrap around we'll delay it by at most HZ. */
-       if (delay > HZ)
+       if (delay > HZ) {
+               linkwatch_nextevent = jiffies;
                delay = 0;
+       }
 
        schedule_delayed_work(&linkwatch_work, delay);
 }