From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: [patch 3/6] allow reconnects to the backend driver Date: Thu, 17 Aug 2006 15:49:22 +0200 Message-ID: <44E473E2.5040308@suse.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070307040703030807080507" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen devel list List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------070307040703030807080507 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 -- Gerd Hoffmann http://www.suse.de/~kraxel/julika-dora.jpeg --------------070307040703030807080507 Content-Type: text/plain; name="backend-reconnect" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="backend-reconnect" Signed-off-by: Gerd Hoffmann Index: source-lnx-stable-22813/drivers/xen/blkback/xenbus.c =================================================================== --- source-lnx-stable-22813.orig/drivers/xen/blkback/xenbus.c 2006-08-17 15:19:20.000000000 +0200 +++ source-lnx-stable-22813/drivers/xen/blkback/xenbus.c 2006-08-17 15:20:17.000000000 +0200 @@ -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: Index: source-lnx-stable-22813/drivers/xen/netback/xenbus.c =================================================================== --- source-lnx-stable-22813.orig/drivers/xen/netback/xenbus.c 2006-08-17 15:19:20.000000000 +0200 +++ source-lnx-stable-22813/drivers/xen/netback/xenbus.c 2006-08-17 15:20:17.000000000 +0200 @@ -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; --------------070307040703030807080507 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------070307040703030807080507--