Skip to contentSkip to conversation

xen-block: treat XenbusStateUnknown the same as XenbusStateClosed

PATCH In review Paul Durrant 3 participants 5 messages Sep 18, 2019 – Sep 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-block: treat XenbusStateUnknown the same as XenbusStateClosed

When a frontend gracefully disconnects from an offline backend, it will set its own state to XenbusStateClosed. The code in xen-block.c correctly deals with this and sets the backend into XenbusStateClosed. Unfortunately it is possible for toolstack to actually delete the frontend area before the state key has been read, leading to an apparent frontend state of XenbusStateUnknown. This prevents the backend state from transitioning to XenbusStateClosed and hence leaves it limbo.

This patch simply treats a frontend state of XenbusStateUnknown the same as XenbusStateClosed, which will unblock the backend in these circumstances.

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>

---
 hw/block/xen-block.c | 1 +
 1 file changed, 1 insertion(+)
hw/block/xen-block.c +1 -0
index f77343db60..879fc310a4 100644
@@ -313,6 +313,7 @@ static void xen_block_frontend_changed(XenDevice *xendev,
         break;
 
     case XenbusStateClosed:
+    case XenbusStateUnknown:
         xen_block_disconnect(xendev, &local_err);
         if (local_err) {
             error_propagate(errp, local_err);
Signature · 7 lines
2.20.1.2.gb21ebb671


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 8 lines · Paul Durrant

When a frontend gracefully disconnects from an offline backend, it will set its own state to XenbusStateClosed. The code in xen-block.c correctly deals with this and sets the backend into XenbusStateClosed. Unfortunately it is possible for toolstack to actually delete the frontend area before the state key has been read, leading to an apparent frontend state of XenbusStateUnknown. This prevents the backend state from transitioning to XenbusStateClosed and hence leaves it limbo.

Does the 0 come from a read into de-allocated memory?

--js

Quoted 20 lines

This patch simply treats a frontend state of XenbusStateUnknown the same as XenbusStateClosed, which will unblock the backend in these circumstances.

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>

---
 hw/block/xen-block.c | 1 +
 1 file changed, 1 insertion(+)
hw/block/xen-block.c +0 -0
index f77343db60..879fc310a4 100644

hw/block/xen-block.c static void xen_block_frontend_changed(XenDevice *xendev, · line 319

Quoted 7 lines
hw/block/xen-block.c +1 -0
@@ -313,6 +313,7 @@ static void xen_block_frontend_changed(XenDevice *xendev,
         break;
 
     case XenbusStateClosed:
+    case XenbusStateUnknown:
         xen_block_disconnect(xendev, &local_err);
         if (local_err) {
             error_propagate(errp, local_err);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 21 lines

-----Original Message-----
From: John Snow <[email protected]>
Sent: 20 September 2019 22:11
To: Paul Durrant <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Kevin Wolf <[email protected]>; Stefano Stabellini <[email protected]>; Max Reitz <[email protected]>; Anthony Perard <[email protected]>; Mark Syms <[email protected]>
Subject: Re: [Qemu-block] [PATCH] xen-block: treat XenbusStateUnknown the same as XenbusStateClosed

Quoted 8 lines · Paul Durrant

When a frontend gracefully disconnects from an offline backend, it will set its own state to XenbusStateClosed. The code in xen-block.c correctly deals with this and sets the backend into XenbusStateClosed. Unfortunately it is possible for toolstack to actually delete the frontend area before the state key has been read, leading to an apparent frontend state of XenbusStateUnknown. This prevents the backend state from transitioning to XenbusStateClosed and hence leaves it limbo.

Quoted 1 line

Does the 0 come from a read into de-allocated memory?

No, it comes from the fact that the xenstore state key is not present. Conventionally a missing state key means the state is reported as XenbusStateUnknown.

Paul

Quoted 24 lines

--js

Quoted 21 lines

This patch simply treats a frontend state of XenbusStateUnknown the same as XenbusStateClosed, which will unblock the backend in these circumstances.

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>

---
 hw/block/xen-block.c | 1 +
 1 file changed, 1 insertion(+)
hw/block/xen-block.c +0 -0
index f77343db60..879fc310a4 100644
@@ -313,6 +313,7 @@ static void xen_block_frontend_changed(XenDevice *xendev,
         break;
 
Quoted 6 lines

hw/block/xen-block.c static void xen_block_frontend_changed(XenDevice *xendev, · line 319

Quoted 6 lines
hw/block/xen-block.c +1 -0
     case XenbusStateClosed:
+    case XenbusStateUnknown:
         xen_block_disconnect(xendev, &local_err);
         if (local_err) {
             error_propagate(errp, local_err);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by
#3 lore raw
Quoted 21 lines · Paul Durrant
Quoted 21 lines

-----Original Message-----
From: John Snow <[email protected]>
Sent: 20 September 2019 22:11
To: Paul Durrant <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Kevin Wolf <[email protected]>; Stefano Stabellini <[email protected]>; Max Reitz <[email protected]>; Anthony Perard <[email protected]>; Mark Syms <[email protected]>
Subject: Re: [Qemu-block] [PATCH] xen-block: treat XenbusStateUnknown the same as XenbusStateClosed

Quoted 8 lines · Paul Durrant

When a frontend gracefully disconnects from an offline backend, it will set its own state to XenbusStateClosed. The code in xen-block.c correctly deals with this and sets the backend into XenbusStateClosed. Unfortunately it is possible for toolstack to actually delete the frontend area before the state key has been read, leading to an apparent frontend state of XenbusStateUnknown. This prevents the backend state from transitioning to XenbusStateClosed and hence leaves it limbo.

Quoted 6 lines
Quoted 1 line

Does the 0 come from a read into de-allocated memory?

No, it comes from the fact that the xenstore state key is not present. Conventionally a missing state key means the state is reported as XenbusStateUnknown.

Paul

Good enough for me, just had to confirm.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#4 lore raw
In reply to Paul Durrant
Quoted 8 lines · Paul Durrant

When a frontend gracefully disconnects from an offline backend, it will set its own state to XenbusStateClosed. The code in xen-block.c correctly deals with this and sets the backend into XenbusStateClosed. Unfortunately it is possible for toolstack to actually delete the frontend area before the state key has been read, leading to an apparent frontend state of XenbusStateUnknown. This prevents the backend state from transitioning to XenbusStateClosed and hence leaves it limbo.

Quoted 5 lines

This patch simply treats a frontend state of XenbusStateUnknown the same as XenbusStateClosed, which will unblock the backend in these circumstances.

Thanks,

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel