aio-posix: Unregister fd from ctx epoll when removing fd_handler.
authorRemy Noel <remy.noel@blade-group.com>
Thu, 20 Dec 2018 15:20:29 +0000 (16:20 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 14 Jan 2019 14:09:41 +0000 (14:09 +0000)
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>
util/aio-posix.c

index 51c41ed3c9f4fac131b05745274c86f33017a389..a927319d2c5ae32745368b678e10a76fa1a2c867 100644 (file)
@@ -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);