OpenVZ Forum


Home » Mailing lists » Devel » [PATCH][VLAN]: Proc entry is not renamed when vlan device name changes.
[PATCH][VLAN]: Proc entry is not renamed when vlan device name changes. [message #28871] Mon, 31 March 2008 13:06 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
This may lead to situations, when each of two proc entries produce
data for the other's device.

Looks like a BUG, so this patch is for net-2.6. It will not apply 
to net-2.6.26 since dev->nd_net access is replaced with dev_net(dev) 
one. Should I rework the patch to fit 2.6.26?

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index dbc81b9..b33410a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -374,17 +374,35 @@ static void vlan_sync_address(struct net_device *dev,
 	memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
 }
 
+static void __vlan_device_event(struct net_device *dev, unsigned long event)
+{
+	switch (event) {
+	case NETDEV_CHANGENAME:
+		vlan_proc_rem_dev(dev);
+		if (vlan_proc_add_dev(dev) < 0)
+			pr_warning("8021q: failed to change proc name for %s\n",
+					dev->name);
+		break;
+	}
+}
+
 static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 			     void *ptr)
 {
 	struct net_device *dev = ptr;
-	struct vlan_group *grp = __vlan_find_group(dev->ifindex);
+	struct vlan_group *grp;
 	int i, flgs;
 	struct net_device *vlandev;
 
 	if (dev->nd_net != &init_net)
 		return NOTIFY_DONE;
 
+	if (is_vlan_dev(dev)) {
+		__vlan_device_event(dev, event);
+		goto out;
+	}
+
+	grp = __vlan_find_group(dev->ifindex);
 	if (!grp)
 		goto out;
 
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 73efcc7..51271ae 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -45,4 +45,9 @@ void vlan_netlink_fini(void);
 
 extern struct rtnl_link_ops vlan_link_ops;
 
+static inline int is_vlan_dev(struct net_device *dev)
+{
+	return dev->priv_flags & IFF_802_1Q_VLAN;
+}
+
 #endif /* !(__BEN_VLAN_802_1Q_INC__) */
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 146cfb0..9671aa5 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -210,11 +210,6 @@ int vlan_proc_rem_dev(struct net_device *vlandev)
  * The following few functions build the content of /proc/net/vlan/config
  */
 
-static inline int is_vlan_dev(struct net_device *dev)
-{
-	return dev->priv_flags & IFF_802_1Q_VLAN;
-}
-
 /* start read of /proc/net/vlan/config */
 static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
 	__acquires(dev_base_lock)
Re: [PATCH][VLAN]: Proc entry is not renamed when vlan device name changes. [message #28912 is a reply to message #28871] Tue, 01 April 2008 06:53 Go to previous messageGo to next message
Patrick McHardy is currently offline  Patrick McHardy
Messages: 107
Registered: March 2006
Senior Member
Pavel Emelyanov wrote:
> This may lead to situations, when each of two proc entries produce
> data for the other's device.
> 
> Looks like a BUG, so this patch is for net-2.6. It will not apply 
> to net-2.6.26 since dev->nd_net access is replaced with dev_net(dev) 
> one. Should I rework the patch to fit 2.6.26?

No, since its a bugfix it should go in net-2.6. Dave, please apply.
Re: [PATCH][VLAN]: Proc entry is not renamed when vlan device name changes. [message #28938 is a reply to message #28912] Wed, 02 April 2008 07:08 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Patrick McHardy <kaber@trash.net>
Date: Tue, 01 Apr 2008 08:53:12 +0200

> Pavel Emelyanov wrote:
> > This may lead to situations, when each of two proc entries produce
> > data for the other's device.
> > 
> > Looks like a BUG, so this patch is for net-2.6. It will not apply 
> > to net-2.6.26 since dev->nd_net access is replaced with dev_net(dev) 
> > one. Should I rework the patch to fit 2.6.26?
> 
> No, since its a bugfix it should go in net-2.6. Dave, please apply.

Done.
Previous Topic: [RFC][PATCH 0/9] cgroups: block: cfq: I/O bandwidth controlling subsystem for CGroups based on CFQ
Next Topic: Document possibility to disable modules in vzctl
Goto Forum:
  


Current Time: Mon May 27 11:30:56 GMT 2024

Total time taken to generate the page: 0.00445 seconds