diff mbox series

[4/6] vhost-user-server: mark fd handlers "external"

Message ID 20200619120046.2422205-4-stefanha@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/6] vhost-user-server: fix VHOST_MEMORY_MAX_REGIONS compiler error | expand

Commit Message

Stefan Hajnoczi June 19, 2020, noon UTC
The event loop has the concept of "external" fd handlers that process
requests from outside clients such as the guest. External fd handlers
are disabled during critical sections where new requests are not
allowed.

The vhost-user-server seems like an "external" client to me and
therefore should mark its file descriptors "external".

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 util/vhost-user-server.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c
index 5230ba3883..a5785cbf86 100644
--- a/util/vhost-user-server.c
+++ b/util/vhost-user-server.c
@@ -235,7 +235,7 @@  set_watch(VuDev *vu_dev, int fd, int vu_evt,
         kick_info->fd = fd;
         kick_info->cb = cb;
         qemu_set_nonblock(fd);
-        aio_set_fd_handler(server->ioc->ctx, fd, false, kick_handler,
+        aio_set_fd_handler(server->ioc->ctx, fd, true, kick_handler,
                            NULL, NULL, kick_info);
         kick_info->vu_dev = vu_dev;
     }
@@ -262,7 +262,7 @@  static void remove_watch(VuDev *vu_dev, int fd)
         return;
     }
     server->kick_info[i].cb = NULL;
-    aio_set_fd_handler(server->ioc->ctx, fd, false, NULL, NULL, NULL, NULL);
+    aio_set_fd_handler(server->ioc->ctx, fd, true, NULL, NULL, NULL, NULL);
 }
 
 
@@ -333,7 +333,7 @@  static void detach_context(VuServer *server)
     qio_channel_detach_aio_context(server->ioc);
     for (i = 0; i < server->vu_dev.max_queues; i++) {
         if (server->kick_info[i].cb) {
-            aio_set_fd_handler(ctx, server->kick_info[i].fd, false, NULL,
+            aio_set_fd_handler(ctx, server->kick_info[i].fd, true, NULL,
                                NULL, NULL, NULL);
         }
     }
@@ -349,7 +349,7 @@  static void attach_context(VuServer *server, AioContext *ctx)
     }
     for (i = 0; i < server->vu_dev.max_queues; i++) {
         if (server->kick_info[i].cb) {
-            aio_set_fd_handler(ctx, server->kick_info[i].fd, false,
+            aio_set_fd_handler(ctx, server->kick_info[i].fd, true,
                                kick_handler, NULL, NULL,
                                &server->kick_info[i]);
         }