From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmPuQ-0003A3-IA for qemu-devel@nongnu.org; Fri, 29 Nov 2013 10:23:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VmPuK-0007kE-BX for qemu-devel@nongnu.org; Fri, 29 Nov 2013 10:23:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmPuK-0007k2-2X for qemu-devel@nongnu.org; Fri, 29 Nov 2013 10:23:04 -0500 Message-ID: <5298B152.10805@redhat.com> Date: Fri, 29 Nov 2013 16:22:58 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385737124-13964-1-git-send-email-marcandre.lureau@gmail.com> <1385737124-13964-10-git-send-email-marcandre.lureau@gmail.com> In-Reply-To: <1385737124-13964-10-git-send-email-marcandre.lureau@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 09/13] nbd: don't change socket block during negotiate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Cc: =?UTF-8?B?TWFyYy1BbmRyw6kgTA==?= =?UTF-8?B?dXJlYXU=?= , qemu-devel@nongnu.org, kraxel@redhat.com Il 29/11/2013 15:58, Marc-Andr=C3=A9 Lureau ha scritto: > From: Marc-Andr=C3=A9 Lureau >=20 > The caller might handle non-blocking using coroutine. Leave the choice > to the caller to use a blocking or non-blocking negotiate. >=20 > Signed-off-by: Marc-Andr=C3=A9 Lureau > --- > nbd.c | 1 - > 1 file changed, 1 deletion(-) >=20 > diff --git a/nbd.c b/nbd.c > index f847940..3af9d17 100644 > --- a/nbd.c > +++ b/nbd.c > @@ -443,7 +443,6 @@ int nbd_receive_negotiate(int csock, const char *na= me, uint32_t *flags, > =20 > TRACE("Receiving negotiation."); > =20 > - qemu_set_block(csock); > rc =3D -EINVAL; > =20 > if (read_sync(csock, buf, 8) !=3D 8) { >=20 If you remove this here, you need to remove also the matching socket_set_nonblock, Also, there are two callers: - nbd.c: you can add nbd_socket_block/nonblock around nbd_receive_negotiate in nbd_open. - qemu-nbd.c: here the socket can remain in blocking mode. In fact it is blocking before the call to nbd_receive_negotiate, because unix_connect_opts is missing a call to qemu_set_block (bug!). I suggest that you add the call to qemu_set_nonblock there, and add qemu_set_block in nbd_client_thread. Thanks, Paolo