From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIxN6-0000nF-JG for qemu-devel@nongnu.org; Tue, 12 Jan 2016 06:44:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIxN5-00045m-P7 for qemu-devel@nongnu.org; Tue, 12 Jan 2016 06:44:20 -0500 Date: Tue, 12 Jan 2016 19:44:13 +0800 From: Fam Zheng Message-ID: <20160112114413.GA3903@ad.usersys.redhat.com> References: <1452483373-22471-1-git-send-email-famz@redhat.com> <1452483373-22471-3-git-send-email-famz@redhat.com> <5693B59A.6040806@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5693B59A.6040806@redhat.com> 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: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-block@nongnu.org On Mon, 01/11 15:00, Paolo Bonzini wrote: > > > 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. > You are right, I'll take a look and work on v3. Fam