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

[Xen-changelog] [linux-2.6.18-xen] frontends: handle backend CLOSED without CLOSING


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 24 Sep 2012 15:44:03 +0000
  • Delivery-date: Mon, 24 Sep 2012 15:44:10 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User David Vrabel <david.vrabel@xxxxxxxxxx>
# Date 1348500969 -7200
# Node ID e09f03f312e52f421e7cf39f81515adb445b5159
# Parent  341104e962db9697186669899917bc3c8ed59525
frontends: handle backend CLOSED without CLOSING

Backend drivers shouldn't transistion to CLOSED unless the frontend is
CLOSED.  If a backend does transition to CLOSED too soon then the
frontend may not see the CLOSING state and will not properly shutdown.

So, treat an unexpected backend CLOSED state the same as CLOSING.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

Extended to scsifront and usbfront.

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


diff -r 341104e962db -r e09f03f312e5 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c   Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/blkfront/blkfront.c   Mon Sep 24 17:36:09 2012 +0200
@@ -277,13 +277,16 @@ static void backend_changed(struct xenbu
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateConnected:
                connect(info);
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's Closing state -- fallthrough */
        case XenbusStateClosing:
                bd = bdget(info->dev);
                if (bd == NULL) {
diff -r 341104e962db -r e09f03f312e5 drivers/xen/fbfront/xenfb.c
--- a/drivers/xen/fbfront/xenfb.c       Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/fbfront/xenfb.c       Mon Sep 24 17:36:09 2012 +0200
@@ -806,7 +806,6 @@ static void xenfb_backend_changed(struct
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -844,6 +843,10 @@ static void xenfb_backend_changed(struct
                }
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                // FIXME is this safe in any dev->state?
                xenbus_frontend_closed(dev);
diff -r 341104e962db -r e09f03f312e5 drivers/xen/fbfront/xenkbd.c
--- a/drivers/xen/fbfront/xenkbd.c      Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/fbfront/xenkbd.c      Mon Sep 24 17:36:09 2012 +0200
@@ -285,7 +285,6 @@ static void xenkbd_backend_changed(struc
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -323,6 +322,10 @@ static void xenkbd_backend_changed(struc
 
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
diff -r 341104e962db -r e09f03f312e5 drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/netfront/netfront.c   Mon Sep 24 17:36:09 2012 +0200
@@ -542,7 +542,6 @@ static void backend_changed(struct xenbu
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -557,6 +556,10 @@ static void backend_changed(struct xenbu
                send_fake_arp(netdev);
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
diff -r 341104e962db -r e09f03f312e5 drivers/xen/pcifront/xenbus.c
--- a/drivers/xen/pcifront/xenbus.c     Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/pcifront/xenbus.c     Mon Sep 24 17:36:09 2012 +0200
@@ -404,13 +404,16 @@ static void __init_refok pcifront_backen
        case XenbusStateInitialising:
        case XenbusStateInitWait:
        case XenbusStateInitialised:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateConnected:
                pcifront_try_connect(pdev);
                break;
 
+       case XenbusStateClosed:
+               if (xdev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                dev_warn(&xdev->dev, "backend going away!\n");
                pcifront_try_disconnect(pdev);
diff -r 341104e962db -r e09f03f312e5 drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c    Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/scsifront/xenbus.c    Mon Sep 24 17:36:09 2012 +0200
@@ -363,9 +363,6 @@ static void scsifront_backend_changed(st
        case XenbusStateUnknown:
        case XenbusStateInitialising:
        case XenbusStateInitWait:
-       case XenbusStateClosed:
-               break;
-
        case XenbusStateInitialised:
                break;
 
@@ -381,6 +378,10 @@ static void scsifront_backend_changed(st
                xenbus_switch_state(dev, XenbusStateConnected);
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's Closing state -- fallthrough */
        case XenbusStateClosing:
                scsifront_disconnect(info);
                break;
diff -r 341104e962db -r e09f03f312e5 drivers/xen/usbfront/xenbus.c
--- a/drivers/xen/usbfront/xenbus.c     Mon Sep 03 15:18:54 2012 +0200
+++ b/drivers/xen/usbfront/xenbus.c     Mon Sep 24 17:36:09 2012 +0200
@@ -339,7 +339,6 @@ static void backend_changed(struct xenbu
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -349,6 +348,10 @@ static void backend_changed(struct xenbu
                        xenbus_switch_state(dev, XenbusStateConnected);
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's Closing state -- fallthrough */
        case XenbusStateClosing:
                usbfront_disconnect(dev);
                break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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