From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aId22-0006in-TK for qemu-devel@nongnu.org; Mon, 11 Jan 2016 09:01:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aId22-0006VV-12 for qemu-devel@nongnu.org; Mon, 11 Jan 2016 09:01:14 -0500 Sender: Paolo Bonzini References: <1452483373-22471-1-git-send-email-famz@redhat.com> <1452483373-22471-3-git-send-email-famz@redhat.com> From: Paolo Bonzini Message-ID: <5693B59A.6040806@redhat.com> Date: Mon, 11 Jan 2016 15:00:58 +0100 MIME-Version: 1.0 In-Reply-To: <1452483373-22471-3-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/2] nbd: Coroutine based nbd_send_negotiate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org On 11/01/2016 04:36, Fam Zheng wrote: > > + aio_set_fd_handler(ctx, client->sock, true, > + nbd_negotiate_continue, > + nbd_negotiate_continue, data->co); > TRACE("Beginning negotiation."); > memset(buf, 0, sizeof(buf)); This causes a busy loop if the socket is writable but the client does not send data. I think you need to set/clear the handler (using qemu_coroutine_self() instead of data->co, probably) every time the direction of negotiation switches. That is, set only a read handler before read_sync, and only a write handler before write_sync. Paolo