From patchwork Fri Aug 26 06:02:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mitsuo Hayasaka X-Patchwork-Id: 111711 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B429CB6F67 for ; Fri, 26 Aug 2011 16:04:21 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753159Ab1HZGEQ (ORCPT ); Fri, 26 Aug 2011 02:04:16 -0400 Received: from mailx.hitachi.co.jp ([133.145.228.49]:33998 "EHLO mailx.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850Ab1HZGEQ (ORCPT ); Fri, 26 Aug 2011 02:04:16 -0400 X-Greylist: delayed 373 seconds by postgrey-1.27 at vger.kernel.org; Fri, 26 Aug 2011 02:04:15 EDT Received: from mail4.hitachi.co.jp by mailx.hitachi.co.jp (8.9.3p3/3.7W-mailx) id PAA06480; Fri, 26 Aug 2011 15:04:14 +0900 (JST) Received: from mlsv1.hitachi.co.jp (unknown [133.144.234.166]) by mail4.hitachi.co.jp (Postfix) with ESMTP id F18D233CC4; Fri, 26 Aug 2011 14:58:00 +0900 (JST) Received: from mfilter06.hitachi.co.jp by mlsv1.hitachi.co.jp (8.13.1/8.13.1) id p7Q5w0Uk015176; Fri, 26 Aug 2011 14:58:00 +0900 Received: from vshuts4.hitachi.co.jp (vshuts4.hitachi.co.jp [10.201.6.80]) by mfilter06.hitachi.co.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id p7Q5vx0l029574; Fri, 26 Aug 2011 14:58:00 +0900 X-AuditID: b753bd60-a32aeba0000019f4-f5-4e5735e7a414 Received: from hsdlmain.sdl.hitachi.co.jp (unknown [133.144.14.194]) by vshuts4.hitachi.co.jp (Symantec Mail Security) with ESMTP id 722B420437E; Fri, 26 Aug 2011 14:57:59 +0900 (JST) Received: from hsdlvgate2.sdl.hitachi.co.jp by hsdlmain.sdl.hitachi.co.jp (8.13.1/3.7W11021512) id p7Q5vx3P010950; Fri, 26 Aug 2011 14:57:59 +0900 X-AuditID: b753bd60-a32aeba0000019f4-f5-4e5735e7a414 Received: from sdl99w.sdl.hitachi.co.jp (sdl99w.sdl.hitachi.co.jp [133.144.14.250]) by hsdlvgate2.sdl.hitachi.co.jp (Symantec Mail Security) with ESMTP id B88C7236561; Fri, 26 Aug 2011 14:57:58 +0900 (JST) Received: from ltc219.sdl.hitachi.co.jp (cb10033149.sdl.hitachi.co.jp [10.232.10.18]) by sdl99w.sdl.hitachi.co.jp (Postfix) with ESMTP id 029191254E3; Fri, 26 Aug 2011 14:57:48 +0900 (JST) From: Mitsuo Hayasaka Subject: [PATCH net-next ] Fix time-lag of IFF_RUNNING flag consistency between vlan and real devices To: Patrick McHardy , "David S. Miller" , Eric Dumazet , =?utf-8?q?Micha=C5=82?= =?utf-8?b?TWlyb3PFgmF3?= , Tom Herbert , Jesse Gross , herbert@gondor.apana.org.au Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yrl.pp-manager.tt@hitachi.com, Mitsuo Hayasaka , Patrick McHardy , "David S. Miller" , Eric Dumazet , =?utf-8?b?Ik1pY2hhxYI=?= =?utf-8?q?Miros=C5=82aw=22?= , Tom Herbert , Jesse Gross Date: Fri, 26 Aug 2011 15:02:57 +0900 Message-ID: <20110826060257.5304.62723.stgit@ltc219.sdl.hitachi.co.jp> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Brightmail-Tracker: AAAAAA== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Cc: Patrick McHardy Cc: "David S. Miller" Cc: Eric Dumazet Cc: "Michał Mirosław" Cc: Tom Herbert Cc: Jesse Gross --- include/linux/if_vlan.h | 2 +- net/core/dev.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;