Skip to content

Commit

Permalink
xen-bus: check whether the frontend is active during device reset...
Browse files Browse the repository at this point in the history
...not the backend

Commit cb32314 "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: cb32314
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 df6180b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
Paul Durrant authored and mdroth committed Oct 14, 2019
1 parent 6341bef commit a678cd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/xen/xen-bus.c
Expand Up @@ -559,7 +559,7 @@ static void xen_device_backend_changed(void *opaque)
* backend state to Closed.
*/
if (xendev->backend_state == XenbusStateClosing &&
!xen_device_state_is_active(state)) {
!xen_device_state_is_active(xendev->frontend_state)) {
xen_device_backend_set_state(xendev, XenbusStateClosed);
}

Expand Down

0 comments on commit a678cd4

Please sign in to comment.