Skip to contentSkip to conversation

xen-bus: check whether the frontend is active during device reset...

PATCH In review Paul Durrant 2 participants 2 messages Sep 10, 2019 – Sep 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 cb3231460747552d70af9d546dc53d8195bcb796

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>

---
 hw/xen/xen-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xen/xen-bus.c +1 -1
index a04478ad4f..025df5e59f 100644
@@ -560,7 +560,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);
     }
 
Signature · 1 line
2.20.1.2.gb21ebb6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Paul Durrant

...not the backend

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

(quoted diff) +3 -3
@@ -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'.

Quoted 4 lines

This patch fixes the mistake.

Fixes cb3231460747552d70af9d546dc53d8195bcb796

Thanks,

Signature · 1 line
Anthony PERARD