Received: from eggs.gnu.org ([209.51.188.92]:60853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj5CN-00025a-UP for qemu-devel@nongnu.org; Mon, 14 Jan 2019 11:34:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj5CM-0001zM-DF for qemu-devel@nongnu.org; Mon, 14 Jan 2019 11:34:51 -0500 From: Stefan Hajnoczi Date: Mon, 14 Jan 2019 16:34:15 +0000 Message-Id: <20190114163416.1094-2-stefanha@redhat.com> In-Reply-To: <20190114163416.1094-1-stefanha@redhat.com> References: <20190114163416.1094-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 1/2] aio-posix: Unregister fd from ctx epoll when removing fd_handler. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Maydell , Fam Zheng , qemu-block@nongnu.org, Stefan Weil , Max Reitz , Kevin Wolf , Remy Noel , Paolo Bonzini From: Remy Noel 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 =3D true; } + /* Clean events in order to unregister fd from the ctx epoll. */ + node->pfd.events =3D 0; + poll_disable_change =3D -!node->io_poll; } else { poll_disable_change =3D !io_poll - (node && !node->io_poll); --=20 2.20.1