From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkQUx-0000A8-DE for qemu-devel@nongnu.org; Fri, 09 Oct 2015 01:45:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkQUw-0003A7-AO for qemu-devel@nongnu.org; Fri, 09 Oct 2015 01:45:43 -0400 From: Fam Zheng Date: Fri, 9 Oct 2015 13:45:17 +0800 Message-Id: <1444369526-2227-4-git-send-email-famz@redhat.com> In-Reply-To: <1444369526-2227-1-git-send-email-famz@redhat.com> References: <1444369526-2227-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH 03/12] nbd: Mark fd handlers client type as "external" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi So we could distinguish it from internal used fds, thus avoid handling unwanted events in nested aio polls. Signed-off-by: Fam Zheng --- include/block/aio.h | 1 + nbd.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/block/aio.h b/include/block/aio.h index 830a0e8..60e796b 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -276,6 +276,7 @@ bool aio_pending(AioContext *ctx); bool aio_dispatch(AioContext *ctx); #define AIO_CLIENT_UNSPECIFIED (1 << 0) +#define AIO_CLIENT_EXTERNAL (1 << 1) #define AIO_CLIENT_MASK_ALL -1 /* Progress in completing AIO work to occur. This can issue new pending diff --git a/nbd.c b/nbd.c index 16a4087..96fcc98 100644 --- a/nbd.c +++ b/nbd.c @@ -1446,7 +1446,7 @@ static void nbd_set_handlers(NBDClient *client) { if (client->exp && client->exp->ctx) { aio_set_fd_handler(client->exp->ctx, client->sock, - AIO_CLIENT_UNSPECIFIED, + AIO_CLIENT_EXTERNAL, client->can_read ? nbd_read : NULL, client->send_coroutine ? nbd_restart_write : NULL, client); @@ -1457,7 +1457,7 @@ static void nbd_unset_handlers(NBDClient *client) { if (client->exp && client->exp->ctx) { aio_set_fd_handler(client->exp->ctx, client->sock, - AIO_CLIENT_UNSPECIFIED, NULL, NULL, NULL); + AIO_CLIENT_EXTERNAL, NULL, NULL, NULL); } } -- 2.5.3