From: kaf24@localhost.localdomain Date: Sat, 19 Aug 2006 09:20:08 +0000 (+0100) Subject: [NET/BLK] back: Change the netback and blkback device drivers to allow X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15710^2~36 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7d0aeaacea0ac1a7855fa2cb17f8cfe3a99e0c08;p=xen.git [NET/BLK] back: Change 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. Signed-off-by: Gerd Hoffmann --- diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c index ca01d15595..0f268c9e33 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c @@ -305,6 +305,11 @@ static void frontend_changed(struct xenbus_device *dev, 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: diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c index 6bb87a636e..a0e3961234 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c @@ -234,10 +234,25 @@ static void frontend_changed(struct xenbus_device *dev, 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;