Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 89877e42827f16fa5f86b1df0c2860b1 > files > 2724

kernel-2.6.18-128.1.10.el5.src.rpm

From: Markus Armbruster <armbru@redhat.com>
Date: Mon, 4 Aug 2008 13:45:19 -0400
Subject: [xen] netfront xenbus race
Message-id: m3myjs1xow.fsf@crossbow.pond.sub.org
O-Subject: [PATCH RHEL-5.3] netfront xenbus race
Bugzilla: 453574
RH-Acked-by: Bill Burns <bburns@redhat.com>
RH-Acked-by: Don Dutile <ddutile@redhat.com>

netfront is the frontend device driver of the Xen paravirtual network
device.

Xen split device drivers synchronize their startup and teardown
through xenstore.  That protocol has known issues that can cause event
channel notifications to get duplicated.  The duplicates need to be
ignored.  Our netfront doesn't, and gets confused when it happens.
The device doesn't work then.

Fix backported from xen-unstable.hg cset 13021:79315be2c9b9.

Bug 453574.  Please ACK.

diff --git a/drivers/xen/netfront/netfront.c b/drivers/xen/netfront/netfront.c
index 41d0178..88ae481 100644
--- a/drivers/xen/netfront/netfront.c
+++ b/drivers/xen/netfront/netfront.c
@@ -551,6 +551,8 @@ static void backend_changed(struct xenbus_device *dev,
 		break;
 
 	case XenbusStateInitWait:
+		if (dev->state != XenbusStateInitialising)
+			break;
 		if (network_connect(netdev) != 0) {
 			netif_free(np);
 			break;
@@ -559,6 +561,8 @@ static void backend_changed(struct xenbus_device *dev,
 		break;
 
 	case XenbusStateClosing:
+		if (dev->state == XenbusStateClosed)
+			break;
  		xenbus_frontend_closed(dev);
 		break;
 	}
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 2e76c7f..1142c8b 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -651,6 +651,8 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
 	if (!xendev)
 		return -ENOMEM;
 
+	xendev->state = XenbusStateInitialising;
+
 	/* Copy the strings into the extra space. */
 
 	tmpstring = (char *)(xendev + 1);