netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next ] Fix time-lag of IFF_RUNNING flag consistency between vlan and real devices
@ 2011-08-26  6:02 Mitsuo Hayasaka
  2011-08-26  6:08 ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: Mitsuo Hayasaka @ 2011-08-26  6:02 UTC (permalink / raw)
  To: Patrick McHardy, David S. Miller, Eric Dumazet,
	MichałMirosław
  Cc: netdev, linux-kernel, yrl.pp-manager.tt, Mitsuo Hayasaka,
	Patrick McHardy, David S. Miller, Eric Dumazet,
	"MichałMirosław", Tom Herbert, Jesse Gross

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.

Why this happens:
Network devices' flags can be checked using ioctl with SIOCGIFFLAGS. When
vlan technique is used, it checks the flags of vlan device, not real
device.

Patch:
This patch adds vlan-device check into dev_get_flags(). So, it can check
flags of the real device even if the vlan is used.

Signed-off-by: Mitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Tom Herbert <therbert@google.com>
Cc: Jesse Gross <jesse@nicira.com>
---

 include/linux/if_vlan.h |    2 +-
 net/core/dev.c          |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 44da482..4df4e6f 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -91,7 +91,7 @@ struct vlan_group {
 	struct rcu_head		rcu;
 };
 
-static inline int is_vlan_dev(struct net_device *dev)
+static inline int is_vlan_dev(const struct net_device *dev)
 {
         return dev->priv_flags & IFF_802_1Q_VLAN;
 }
diff --git a/net/core/dev.c b/net/core/dev.c
index a4306f7..527e21b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4603,6 +4603,13 @@ unsigned dev_get_flags(const struct net_device *dev)
 		(dev->gflags & (IFF_PROMISC |
 				IFF_ALLMULTI));
 
+	/*
+	 * If we're trying to get flags on a vlan device
+	 * use the underlying physical device instead.
+	 */
+	if (is_vlan_dev(dev))
+		dev = vlan_dev_real_dev(dev);
+
 	if (netif_running(dev)) {
 		if (netif_oper_up(dev))
 			flags |= IFF_RUNNING;

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

end of thread, other threads:[~2011-09-15 19:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26  6:02 [PATCH net-next ] Fix time-lag of IFF_RUNNING flag consistency between vlan and real devices Mitsuo Hayasaka
2011-08-26  6:08 ` Stephen Hemminger
2011-08-26  6:45   ` Herbert Xu
2011-08-28 13:20     ` HAYASAKA Mitsuo
2011-08-28 14:09       ` Eric Dumazet
2011-08-29  6:06         ` Stephen Hemminger
2011-08-29  6:23           ` Eric Dumazet
2011-08-29  6:34           ` David Miller
2011-08-31  9:31         ` [PATCH net-next] net: linkwatch: allow vlans to get carrier changes faster Eric Dumazet
2011-09-01 11:53           ` HAYASAKA Mitsuo
2011-09-15 19:44           ` David Miller

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