Skip to contentSkip to conversation

review For Oracle bug 14470382

DISCUSSION jianhai luan 5 participants 12 messages Jan 18, 2013 – Jan 19, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

Thanks,
Jason

#1 lore raw
Quoted 7 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

[PATCH] net/core: add NETDEV_BONDING_FAILOVER event

Quoted 3 lines

Thanks,
Jason

From c1da4ac752b8b0411791d26c678fcf23d2eed242 Mon Sep 17 00:00:00 2001
From: Or Gerlitz <[email protected]>
Date: Fri, 13 Jun 2008 18:12:00 -0700
Subject: [PATCH] net/core: add NETDEV_BONDING_FAILOVER event

Add NETDEV_BONDING_FAILOVER event to be used in a successive patch by bonding to announce fail-over for the active-backup mode through the netdev events notifier chain mechanism. Such an event can be of use for the RDMA CM (communication manager) to let native RDMA ULPs (eg NFS-RDMA, iSER) always be aligned with the IP stack, in the sense that they use the same ports/links as the stack does. More usages can be done to allow monitoring tools based on netlink events being aware to bonding fail-over.

---
 include/linux/netdevice.h |    1 +
 include/linux/notifier.h  |    1 +
 net/core/dev.c            |    6 ++++++
 3 files changed, 8 insertions(+), 0 deletions(-)
include/linux/netdevice.h +1 -0
index f27fd20..e92fc83 100644
@@ -1479,6 +1479,7 @@ extern void		__dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct
 extern void		dev_set_promiscuity(struct net_device *dev, int inc);
 extern void		dev_set_allmulti(struct net_device *dev, int inc);
 extern void		netdev_state_change(struct net_device *dev);
+extern void		netdev_bonding_change(struct net_device *dev);
 extern void		netdev_features_change(struct net_device *dev);
 /* Load a device via the kmod */
 extern void		dev_load(struct net *net, const char *name);
include/linux/notifier.h +1 -0
index 0ff6224..bd3d72d 100644
@@ -197,6 +197,7 @@ static inline int notifier_to_errno(int ret)
 #define NETDEV_GOING_DOWN	0x0009
 #define NETDEV_CHANGENAME	0x000A
 #define NETDEV_FEAT_CHANGE	0x000B
+#define NETDEV_BONDING_FAILOVER 0x000C
 
 #define SYS_DOWN	0x0001	/* Notify of system down */
 #define SYS_RESTART	SYS_DOWN
net/core/dev.c +6 -0
index 68d8df0..0e45742 100644
@@ -961,6 +961,12 @@ void netdev_state_change(struct net_device *dev)
 	}
 }
 
+void netdev_bonding_change(struct net_device *dev)
+{
+	call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, dev);
+}
+EXPORT_SYMBOL(netdev_bonding_change);
+
 /**
  *	dev_load 	- load a network module
  *	@net: the applicable net namespace
Signature · 1 line
1.7.6.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
In reply to jianhai luan
Quoted 7 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

[PATCH] net/core: add NETDEV_BONDING_FAILOVER event

Quoted 3 lines

Thanks,
Jason

From 01f3109de49a889db8adf9116449727547ee497e Mon Sep 17 00:00:00 2001
From: Or Gerlitz <[email protected]>
Date: Fri, 13 Jun 2008 18:12:02 -0700
Subject: [PATCH] bonding: deliver netdev event for fail-over under the
active-backup mode

under active-backup mode and when there's actual new_active slave, have bond_change_active_slave() call the networking core to deliver NETDEV_BONDING_FAILOVER event such that the fail-over can be notable by code outside of the bonding driver such as the RDMA stack and monitoring tools.

As the correct context of locking appropriate for notifier calls is RTNL and nothing else, bond->curr_slave_lock and bond->lock are unlocked and later locked again. This is ensured by the rest of the code to be safe under backup-mode AND when new_active is not NULL.

Jay Vosburgh modified the original patch for formatting and fixed a compiler error.

---
 drivers/net/bonding/bond_main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_main.c +8 -0
index 2db2d05..925402b 100644
@@ -1203,6 +1203,14 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
 				dprintk("delaying gratuitous arp on %s\n",
 					bond->curr_active_slave->dev->name);
 			}
+
+			write_unlock_bh(&bond->curr_slave_lock);
+			read_unlock(&bond->lock);
+
+			netdev_bonding_change(bond->dev);
+
+			read_lock(&bond->lock);
+			write_lock_bh(&bond->curr_slave_lock);
 		}
 	}
 }
Signature · 1 line
1.7.6.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
In reply to jianhai luan
Quoted 8 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

[PATCH]Change function netdev_bonding_change

Quoted 2 lines

Thanks,
Jason

From 75c78500ddad74b229cd0691496b8549490496a2 Mon Sep 17 00:00:00 2001
From: Moni Shoua <[email protected]>
Date: Tue, 15 Sep 2009 02:37:40 -0700
Subject: [PATCH] bonding: remap muticast addresses without using dev_close()
and dev_open()

This patch fixes commit e36b9d16c6a6d0f59803b3ef04ff3c22c3844c10. The approach there is to call dev_close()/dev_open() whenever the device type is changed in order to remap the device IP multicast addresses to HW multicast addresses. This approach suffers from 2 drawbacks:

*. It assumes tha the device is UP when calling dev_close(), or otherwise
dev_close() has no affect. It is worth to mention that initscripts (Redhat) and sysconfig (Suse) doesn't act the same in this matter.
*. dev_close() has other side affects, like deleting entries from the routing
table, which might be unnecessary.

The fix here is to directly remap the IP multicast addresses to HW multicast addresses for a bonding device that changes its type, and nothing else.

drivers/net/bonding/bond_main.c +1 -1
diff -Nur linux-2.6.18.i686.0002/drivers/net/bonding/bond_main.c linux-2.6.18.i686/drivers/net/bonding/bond_main.c
@@ -1103,7 +1103,7 @@
 			write_unlock_bh(&bond->curr_slave_lock);
 			read_unlock(&bond->lock);
 
-			netdev_bonding_change(bond->dev);
+			netdev_bonding_change(bond->dev, NETDEV_BONDING_FAILOVER);
 
 			read_lock(&bond->lock);
 			write_lock_bh(&bond->curr_slave_lock);
include/linux/netdevice.h +2 -1
diff -Nur linux-2.6.18.i686.0002/include/linux/netdevice.h linux-2.6.18.i686/include/linux/netdevice.h
@@ -1004,7 +1004,8 @@
 extern void		dev_set_promiscuity(struct net_device *dev, int inc);
 extern void		dev_set_allmulti(struct net_device *dev, int inc);
 extern void		netdev_state_change(struct net_device *dev);
-extern void		netdev_bonding_change(struct net_device *dev);
+extern void		netdev_bonding_change(struct net_device *dev,
+					      unsigned long event);
 extern void		netdev_features_change(struct net_device *dev);
 /* Load a device via the kmod */
 extern void		dev_load(const char *name);
net/core/dev.c +2 -2
diff -Nur linux-2.6.18.i686.0002/net/core/dev.c linux-2.6.18.i686/net/core/dev.c
@@ -797,9 +797,9 @@
 	}
 }
 
-void netdev_bonding_change(struct net_device *dev)
+void netdev_bonding_change(struct net_device *dev, unsigned long event)
 {
-	call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, dev);
+	call_netdevice_notifiers(event, dev);
 }
 EXPORT_SYMBOL(netdev_bonding_change);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
In reply to jianhai luan
Quoted 7 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

[PATCH] Notify DomU to send gratuitous ARP initially by Connected->Connected transition

Quoted 3 lines

Thanks,
Jason

From 6d27fe89373b000d750ae0a8b9fb831357e286ed Mon Sep 17 00:00:00 2001
From: Jason Luan <[email protected]>
Date: Fri, 28 Dec 2012 15:43:06 +0800
Subject: [PATCH] xen-netback notify frontend to send gratuitous ARP.

In the real network environment, some cause will lead to Active-Backup mode bonding chose new actived port. After that, the trffic, destinated to DomU by inactived port (former actived port), will be unreachable at now. DomU should send gratutious ARP initialtivly to find the new corrected path.

By netback's Connected->Connected transition, frontend will watch the change, and send gratuitous ARP.

---

drivers/xen/netback/common.h +2 -0
diff -Nur linux-2.6.18.i686.orig/drivers/xen/netback/common.h linux-2.6.18.i686/drivers/xen/netback/common.h
@@ -151,6 +151,8 @@
 	void *netback_accel_priv;
 	/* The accelerator that this backend is currently using */
 	struct netback_accelerator *accelerator;
+
+	struct notifier_block vif_notifier;
 };
 
 #define NETBACK_ACCEL_VERSION 0x00010001
drivers/xen/netback/xenbus.c +67 -0

83 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
Quoted 19 lines · jianhai luan
drivers/xen/netback/xenbus.c +19 -0
+/**
+ * By Connected->Connected transition, netfront will watch the change and
+ * send gratuitous ARP.
+ */
+static void notify_front_arping(struct xenbus_device *dev)
+{
+	struct xenbus_transaction xbt;
+	int err;
+
+	if (xenbus_read_driver_state(dev->nodename) != XenbusStateConnected)
+		return;
+
+again:
+	err = xenbus_transaction_start(&xbt);
+	if (err) {
+		printk(KERN_ALERT "Error starting transaction");
+		return;
+	}
+

drivers/xen/netback/xenbus.c line 64

Quoted 10 lines
drivers/xen/netback/xenbus.c +10 -0
+	err = xenbus_printf(xbt, dev->nodename, "state", "%d", dev->state);
+	if(err) {
+		printk(KERN_ALERT "Error writing the state");
+		xenbus_transaction_end(xbt, 1);
+		return;
+	}
+	
+	err = xenbus_transaction_end(xbt, 0);
+	if (err == -EAGAIN)
+		goto again;

Why would we get a -EAGAIN here? My reading says that it would have to come as the msg->body from the XenServer. I would be tempted to just ignore those errors.

(I don't know anything about Xen though, so I'm probably full of crap).

regards,
dan carpenter

#6 lore raw
Quoted 26 lines · Dan Carpenter
Quoted 25 lines · jianhai luan
drivers/xen/netback/xenbus.c +25 -0
+/**
+ * By Connected->Connected transition, netfront will watch the change and
+ * send gratuitous ARP.
+ */
+static void notify_front_arping(struct xenbus_device *dev)
+{
+	struct xenbus_transaction xbt;
+	int err;
+
+	if (xenbus_read_driver_state(dev->nodename) != XenbusStateConnected)
+		return;
+
+again:
+	err = xenbus_transaction_start(&xbt);
+	if (err) {
+		printk(KERN_ALERT "Error starting transaction");
+		return;
+	}
+
+	err = xenbus_printf(xbt, dev->nodename, "state", "%d", dev->state);
+	if(err) {
+		printk(KERN_ALERT "Error writing the state");
+		xenbus_transaction_end(xbt, 1);
+		return;
+	}
Quoted 8 lines

drivers/xen/netback/xenbus.c line 64

Quoted 4 lines
drivers/xen/netback/xenbus.c +4 -0
+	
+	err = xenbus_transaction_end(xbt, 0);
+	if (err == -EAGAIN)
+		goto again;

Why would we get a -EAGAIN here? My reading says that it would have to come as the msg->body from the XenServer. I would be tempted to just ignore those errors.

EAGAIN is what the xenstore daemon returns when a transaction fails, e.g. due to a conflicting change.

However a single xenbus_printf as used here doesn't need a transaction since it is only a single atomic operation.

On the other hand I'm not convinced that the initial read of the current state didn't ought to be inside the transaction too, although I've not thought about it terribly hard...

Ian.

#7 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

However a single xenbus_printf as used here doesn't need a transaction since it is only a single atomic operation.

Right.

Quoted 3 lines

On the other hand I'm not convinced that the initial read of the current state didn't ought to be inside the transaction too, although I've not thought about it terribly hard...

I don't think so - this is just a safeguard, and I think it could as well look directly at dev->state.

Jan

#8 lore raw
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

However a single xenbus_printf as used here doesn't need a transaction since it is only a single atomic operation.

Right.

If the fact is that, the code will be simple. i will modify it.

Quoted 6 lines
Quoted 4 lines

On the other hand I'm not convinced that the initial read of the current state didn't ought to be inside the transaction too, although I've not thought about it terribly hard...

I don't think so - this is just a safeguard, and I think it could as well look directly at dev->state.

Right, this is just a safeguard. you think that the below way is better?

if (dev->state != XenbusStateConnected)

    return;
Quoted 8 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Thanks,
Jason

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw
In reply to jianhai luan
Quoted 8 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

The Above PATCH have been tested at some systems (Linux, Window, Solaris, NetBsd). The result is below:

Linux     PASS(send ARP, no other issue)
Window    PASS(don't send ARP, but no other issue)
Solaris   PASS(don't send ARP, but no other issue)
NetBSD    PASS(don't send ARP, but no other issue)
Quoted 2 lines

Thanks,
Jason

#10 lore raw

Sorry, i add wrong mail address. Because the patches for review in internal oracle only, please ignore it.

Quoted 20 lines · jianhai luan
Quoted 8 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

The Above PATCH have been tested at some systems (Linux, Window, Solaris, NetBsd). The result is below:

Linux     PASS(send ARP, no other issue)
Window    PASS(don't send ARP, but no other issue)
Solaris   PASS(don't send ARP, but no other issue)
NetBSD    PASS(don't send ARP, but no other issue)
Quoted 2 lines

Thanks,
Jason

#11 lore raw
In reply to jianhai luan

Because i add wrong mail address([email protected]), please delete the address when you replay.

I'm so sorry for your inconvenient.

Thanks,
Jason

Quoted 20 lines · jianhai luan
Quoted 8 lines · jianhai luan

orabug: 14470382

When Dom0's network environment change, for example the issue, DomU should send send gratuitous ARP initially to notify how to reach it.

To fix the bug, we should modify backend and frontend at the same time. For fixing frontend, i filer the new bug 16182568. The review only to backend.

For fixing the backend, I have 4 patch for review.

The Above PATCH have been tested at some systems (Linux, Window, Solaris, NetBsd). The result is below:

Linux     PASS(send ARP, no other issue)
Window    PASS(don't send ARP, but no other issue)
Solaris   PASS(don't send ARP, but no other issue)
NetBSD    PASS(don't send ARP, but no other issue)
Quoted 2 lines

Thanks,
Jason