Skip to contentSkip to conversation

allow reconnects to the backend driver

PATCH In review Gerd Hoffmann 1 participant 1 message Aug 17, 2006 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 allow reconnects to the backend driver

Hi,

The patch below changes the netback and blkback device drivers to allow and handle frontend state transition from "Closing" to "Initialising". Instead of destroying the backend device then they wait for a reconnect from the frontend. Needed for domU kexec support, to hand over devices from one kernel instance to the next.

please apply,

Gerd

Signature · 2 lines
Gerd Hoffmann <[email protected]>
http://www.suse.de/~kraxel/julika-dora.jpeg
drivers/xen/blkback/xenbus.c +5 -0
Index: source-lnx-stable-22813/drivers/xen/blkback/xenbus.c
===================================================================
@@ -305,6 +305,11 @@ static void frontend_changed(struct xenb
 
 	switch (frontend_state) {
 	case XenbusStateInitialising:
+		if (dev->state == XenbusStateClosing) {
+			printk("%s: %s: prepare for reconnect\n",
+			       __FUNCTION__, dev->nodename);
+			xenbus_switch_state(dev, XenbusStateInitWait);
+		}
 		break;
 
 	case XenbusStateInitialised:
drivers/xen/netback/xenbus.c +15 -0
Index: source-lnx-stable-22813/drivers/xen/netback/xenbus.c
===================================================================
@@ -228,10 +228,25 @@ static void frontend_changed(struct xenb
 
 	switch (frontend_state) {
 	case XenbusStateInitialising:
+		if (dev->state == XenbusStateClosing) {
+			printk("%s: %s: prepare for reconnect\n",
+			       __FUNCTION__, dev->nodename);
+			if (be->netif) {
+				netif_disconnect(be->netif);
+				be->netif = NULL;
+			}
+			xenbus_switch_state(dev, XenbusStateInitWait);
+		}
+		break;
+
 	case XenbusStateInitialised:
 		break;
 
 	case XenbusStateConnected:
+		if (!be->netif) {
+			/* reconnect: setup be->netif */
+			backend_changed(&be->backend_watch, NULL, 0);
+		}
 		maybe_connect(be);
 		break;
 

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