From 8821b34a7362d69b325c045dad4557782775683b Mon Sep 17 00:00:00 2001 From: Remy Noel Date: Thu, 20 Dec 2018 16:20:29 +0100 Subject: [PATCH] aio-posix: Unregister fd from ctx epoll when removing fd_handler. Cleaning the events will cause aio_epoll_update to unregister the fd. Otherwise, the fd is kept registered until it is destroyed. Signed-off-by: Remy Noel Reviewed-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini Message-id: 20181220152030.28035-2-remy.noel@blade-group.com Signed-off-by: Stefan Hajnoczi --- util/aio-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/aio-posix.c b/util/aio-posix.c index 51c41ed3c9..a927319d2c 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -245,6 +245,9 @@ void aio_set_fd_handler(AioContext *ctx, QLIST_REMOVE(node, node); deleted = true; } + /* Clean events in order to unregister fd from the ctx epoll. */ + node->pfd.events = 0; + poll_disable_change = -!node->io_poll; } else { poll_disable_change = !io_poll - (node && !node->io_poll);