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

[Xen-devel] [PATCH 1/2] xen-bus: Fix backend state transition on device reset



When a frontend want to reset its state and the backend one, it start
with setting "Closing", then wait for the backend (QEMU) to do the same.

But when QEMU is setting "Closing" to its state, it trigger an event
(xenstore watch) that re-execute xen_device_backend_changed() and set
the backend state to "Closed". QEMU should wait for the frontend to
set "Closed" before doing the same.

Before setting "Closed" to the backend_state, we are also going to
check if the frontend was responsible for the transition to "Closing".

Fixes: b6af8926fb858c4f1426e5acb2cfc1f0580ec98a
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
Cc: qemu-stable@xxxxxxxxxx
---
 hw/xen/xen-bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
index e40500242d..982eca4533 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -540,9 +540,11 @@ static void xen_device_backend_changed(void *opaque)
     /*
      * If the toolstack (or unplug request callback) has set the backend
      * state to Closing, but there is no active frontend (i.e. the
-     * state is not Connected) then set the backend state to Closed.
+     * state is not Connected or Closing) then set the backend state
+     * to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
+        xendev->frontend_state != XenbusStateClosing &&
         xendev->frontend_state != XenbusStateConnected) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);
     }
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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