qemu/hw/xen
Paul Durrant c12adfd8f6 xen-bus: check whether the frontend is active during device reset...
...not the backend

Commit cb323146 "xen-bus: Fix backend state transition on device reset"
contained a subtle mistake. The hunk

@@ -539,11 +556,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 to Closing, but there is no active frontend then set the
+     * backend state to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
-        xendev->frontend_state != XenbusStateConnected) {
+        !xen_device_state_is_active(state)) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);
     }

mistakenly replaced the check of 'xendev->frontend_state' with a check
(now in a helper function) of 'state', which actually equates to
'xendev->backend_state'.

This patch fixes the mistake.

Fixes: cb32314607
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20190910171753.3775-1-paul.durrant@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
(cherry picked from commit df6180bb56)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-10-27 23:43:19 -05:00
..
Makefile.objs xen: add a mechanism to automatically create XenDevice-s... 2019-01-14 13:45:40 +00:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00
xen-backend.c xen: add a mechanism to automatically create XenDevice-s... 2019-01-14 13:45:40 +00:00
xen-bus-helper.c xen: add xenstore watcher infrastructure 2019-01-14 13:45:40 +00:00
xen-bus.c xen-bus: check whether the frontend is active during device reset... 2019-10-27 23:43:19 -05:00
xen-common.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
xen-host-pci-device.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
xen-host-pci-device.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
xen-legacy-backend.c xen: Import other xen/io/*.h 2019-06-24 10:42:30 +01:00
xen_devconfig.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00
xen_pt.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00
xen_pt.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
xen_pt_config_init.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00
xen_pt_graphics.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00
xen_pt_load_rom.c xen: Don't use memory_region_init_ram_nomigrate() in pci_assign_dev_load_option_rom() 2018-06-22 13:28:42 +01:00
xen_pt_msi.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00
xen_pvdev.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00