From d3bd5b90890f6715bcee38e00745112157dfbe59 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 18 Feb 2019 14:56:01 +0100 Subject: nbd: Use low-level QIOChannel API in nbd_read_eof() Instead of using the convenience wrapper qio_channel_read_all_eof(), use the lower level QIOChannel API. This means duplicating some code, but we'll need this because this coroutine yield is special: We want it to be interruptible so that nbd_client_attach_aio_context() can correctly reenter the coroutine. This moves the bdrv_dec/inc_in_flight() pair into nbd_read_eof(), so that connection_co will always sit in this exact qio_channel_yield() call when bdrv_drain() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- include/block/nbd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/block') diff --git a/include/block/nbd.h b/include/block/nbd.h index cad975e00c..c6ef1ef42e 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -300,8 +300,8 @@ int nbd_receive_export_list(QIOChannel *ioc, QCryptoTLSCreds *tlscreds, int nbd_init(int fd, QIOChannelSocket *sioc, NBDExportInfo *info, Error **errp); int nbd_send_request(QIOChannel *ioc, NBDRequest *request); -int coroutine_fn nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, - Error **errp); +int coroutine_fn nbd_receive_reply(BlockDriverState *bs, QIOChannel *ioc, + NBDReply *reply, Error **errp); int nbd_client(int fd); int nbd_disconnect(int fd); int nbd_errno_to_system_errno(int err); -- cgit v1.2.3-55-g7522