Received: from eggs.gnu.org ([2001:4830:134:3::10]:51802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnEVJ-0006cG-2t for qemu-devel@nongnu.org; Sun, 01 Dec 2013 16:24:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnEVA-00082X-KZ for qemu-devel@nongnu.org; Sun, 01 Dec 2013 16:24:36 -0500 Received: from mail-qa0-x22e.google.com ([2607:f8b0:400d:c00::22e]:49437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnEVA-00082R-EJ for qemu-devel@nongnu.org; Sun, 01 Dec 2013 16:24:28 -0500 Received: by mail-qa0-f46.google.com with SMTP id f11so3652163qae.12 for ; Sun, 01 Dec 2013 13:24:27 -0800 (PST) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sun, 1 Dec 2013 22:23:42 +0100 Message-Id: <1385933027-21261-10-git-send-email-marcandre.lureau@gmail.com> In-Reply-To: <1385933027-21261-1-git-send-email-marcandre.lureau@gmail.com> References: <1385933027-21261-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCHv2 09/14] nbd: don't change socket block during negotiate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, kraxel@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau The caller might handle non-blocking using coroutine. Leave the choice to the caller to use a blocking or non-blocking negotiate. Signed-off-by: Marc-André Lureau --- block/nbd-client.c | 1 + nbd.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/block/nbd-client.c b/block/nbd-client.c index 1abfc6a..693110d 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -348,6 +348,7 @@ int nbd_client_session_init(NbdClientSession *client, int ret; /* NBD handshake */ + qemu_set_block(sock); ret = nbd_receive_negotiate(sock, client->export_name, &client->nbdflags, &client->size, &client->blocksize); diff --git a/nbd.c b/nbd.c index f847940..030f56b 100644 --- a/nbd.c +++ b/nbd.c @@ -443,7 +443,6 @@ int nbd_receive_negotiate(int csock, const char *name, uint32_t *flags, TRACE("Receiving negotiation."); - qemu_set_block(csock); rc = -EINVAL; if (read_sync(csock, buf, 8) != 8) { @@ -558,7 +557,6 @@ int nbd_receive_negotiate(int csock, const char *name, uint32_t *flags, rc = 0; fail: - qemu_set_nonblock(csock); return rc; } -- 1.8.4.2