From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aE9dh-0003pB-0P for qemu-devel@nongnu.org; Wed, 30 Dec 2015 00:49:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aE9dg-0004ky-0C for qemu-devel@nongnu.org; Wed, 30 Dec 2015 00:49:36 -0500 From: Fam Zheng Date: Wed, 30 Dec 2015 13:49:24 +0800 Message-Id: <1451454566-15005-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH 0/2] nbd: Async built-in server negotiation 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 During nbd_send_negotiate, if the client simply doesn't respond, the function will not return, and the whole event loop is blocked. Make the I/O effectively asynchronous by using coroutine read/write, so that a malicious or disappeared client cannot make a hang. Fam Fam Zheng (2): nbd: Interface tweak of nbd_client_new nbd: Coroutine based nbd_send_negotiate blockdev-nbd.c | 5 ++- include/block/nbd.h | 6 ++-- nbd.c | 87 ++++++++++++++++++++++++++++++++++++++++------------- qemu-nbd.c | 16 +++++----- 4 files changed, 81 insertions(+), 33 deletions(-) -- 2.4.3