Re: [Qemu-devel] [PATCH v2 2/2] nbd: Coroutine based nbd_send_negotiate

2016-01-12 Thread Fam Zheng
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

Re: [Qemu-devel] [PATCH v2 2/2] nbd: Coroutine based nbd_send_negotiate

2016-01-11 Thread Paolo Bonzini
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 bu

[Qemu-devel] [PATCH v2 2/2] nbd: Coroutine based nbd_send_negotiate

2016-01-10 Thread Fam Zheng
Create a coroutine in nbd_client_new, so that nbd_send_negotiate doesn't need qemu_set_block(). A handler is needed for csock fd in case the coroutine yields during I/O. With this, if the other end disappears in the middle of the negotiation, we don't block the whole event loop. Signed-off-by: F