[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux-2.6.18/blkback: also call blkif_disconnect() when frontend switched to closed

  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Fri, 09 Mar 2012 14:11:46 +0000
  • Delivery-date: Fri, 09 Mar 2012 14:11:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

blkfront doesn't normally set its state to XenbusStateClosing, yet
blkback should not hang on to resources when there's no connection. As
frontend_changed() already makes use of blkif_disconnect() being
idempotent, we're fine to utilize this here too.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/drivers/xen/blkback/xenbus.c
+++ b/drivers/xen/blkback/xenbus.c
@@ -392,13 +392,11 @@ static void frontend_changed(struct xenb
        case XenbusStateClosing:
-               blkif_disconnect(be->blkif);
-               xenbus_switch_state(dev, XenbusStateClosing);
-               break;
        case XenbusStateClosed:
-               xenbus_switch_state(dev, XenbusStateClosed);
-               if (xenbus_dev_is_online(dev))
+               blkif_disconnect(be->blkif);
+               xenbus_switch_state(dev, frontend_state);
+               if (frontend_state != XenbusStateClosed ||
+                   xenbus_dev_is_online(dev))
                /* fall through if not online */
        case XenbusStateUnknown:

Attachment: xen-blkback-disconnect.patch
Description: Text document

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.