All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] xen-bus: check whether the frontend is active during device reset...
@ 2019-09-10 17:17 Paul Durrant
  2019-09-11  9:04 ` Anthony PERARD
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Durrant @ 2019-09-10 17:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Perard, Paul Durrant, Stefano Stabellini

...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
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
---
 hw/xen/xen-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
index a04478ad4f..025df5e59f 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -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);
     }
 
-- 
2.20.1.2.gb21ebb6



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] xen-bus: check whether the frontend is active during device reset...
  2019-09-10 17:17 [Qemu-devel] [PATCH] xen-bus: check whether the frontend is active during device reset Paul Durrant
@ 2019-09-11  9:04 ` Anthony PERARD
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony PERARD @ 2019-09-11  9:04 UTC (permalink / raw)
  To: Paul Durrant; +Cc: Stefano Stabellini, qemu-devel

On Tue, Sep 10, 2019 at 06:17:53PM +0100, Paul Durrant wrote:
> ...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
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-11  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 17:17 [Qemu-devel] [PATCH] xen-bus: check whether the frontend is active during device reset Paul Durrant
2019-09-11  9:04 ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.