summary refs log tree commit diff stats
path: root/util/aio-posix.c
diff options
context:
space:
mode:
authorRemy Noel <remy.noel@blade-group.com>2018-12-20 16:20:29 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2019-01-14 14:09:41 +0000
commit8821b34a7362d69b325c045dad4557782775683b (patch)
tree628379b8ce8555f07907862dbfb5a345eacf9b00 /util/aio-posix.c
parent7260438b7056469610ee166f7abe9ff8a26b8b16 (diff)
downloadfocaccia-qemu-8821b34a7362d69b325c045dad4557782775683b.tar.gz
focaccia-qemu-8821b34a7362d69b325c045dad4557782775683b.zip
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 <remy.noel@blade-group.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20181220152030.28035-2-remy.noel@blade-group.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/aio-posix.c')
-rw-r--r--util/aio-posix.c3
1 files changed, 3 insertions, 0 deletions
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);