net: linkwatch: allow vlans to get carrier changes faster
authorEric Dumazet <[email protected]>
Tue, 30 Aug 2011 23:31:58 +0000 (23:31 +0000)
committerDavid S. Miller <[email protected]>
Thu, 15 Sep 2011 19:36:34 +0000 (15:36 -0400)
There is a time-lag of IFF_RUNNING flag consistency between vlan and
real devices when the real devices are in problem such as link or cable
broken.

This leads to a degradation of Availability such as a delay of failover
in HA systems using vlan since the detection of the problem at real
device is delayed.

We can avoid the linkwatch delay (~1 sec) for devices linked to another
ones, since delay is already done for the realdev.

Based on a previous patch from Mitsuo Hayasaka

Reported-by: Mitsuo Hayasaka <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: Patrick McHardy <[email protected]>
Cc: "Michał Mirosław" <[email protected]>
Cc: Tom Herbert <[email protected]>
Cc: Stephen Hemminger <[email protected]>
Cc: Jesse Gross <[email protected]>
Tested-by: Mitsuo Hayasaka <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/core/link_watch.c

index 357bd4ee4baa324f1402ae3d7a44c37ce4d1e46e..c3519c6d1b169a5c895efd781c7958218d7f8dc6 100644 (file)
@@ -78,8 +78,13 @@ static void rfc2863_policy(struct net_device *dev)
 
 static bool linkwatch_urgent_event(struct net_device *dev)
 {
-       return netif_running(dev) && netif_carrier_ok(dev) &&
-               qdisc_tx_changing(dev);
+       if (!netif_running(dev))
+               return false;
+
+       if (dev->ifindex != dev->iflink)
+               return true;
+
+       return netif_carrier_ok(dev) && qdisc_tx_changing(dev);
 }