[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XENVKBD PATCH] Early-stop state wait when backend disappears



During unplug, if the backend disappears before FrontendWaitForBackend-
XenbusStateChange is called, that function will block at
XenbusStateUnknown and cause the system to hang until the timeout
expires.

Break out of the watch loop as soon as this condition is detected to
avoid this hang.

Ported from Xenvif.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvkbd/frontend.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/xenvkbd/frontend.c b/src/xenvkbd/frontend.c
index 801ba35..a1f16f8 100644
--- a/src/xenvkbd/frontend.c
+++ b/src/xenvkbd/frontend.c
@@ -462,7 +462,12 @@ FrontendWaitForBackendXenbusStateChange(
                               __FrontendGetBackendPath(Frontend),
                               "state",
                               &Buffer);
-        if (!NT_SUCCESS(status)) {
+        if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
+            *State = XenbusStateUnknown;
+            Trace("%s disappeared\n",
+                  __FrontendGetBackendPath(Frontend));
+            break;
+        } else if (!NT_SUCCESS(status)) {
             *State = XenbusStateUnknown;
         } else {
             *State = (XenbusState)strtol(Buffer, NULL, 10);
-- 
2.51.0.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.