On 23/08/2017 16:45, Stefan Hajnoczi wrote: > That depends on the BDRV_POLL_WHILE() allowing all request coroutines to > terminate before we call nbd_client_detach_aio_context(): > > qio_channel_shutdown(client->ioc, > QIO_CHANNEL_SHUTDOWN_BOTH, > NULL); > BDRV_POLL_WHILE(bs, client->read_reply_co); > > nbd_client_detach_aio_context(bs); > > I'm not sure we have any guarantee that request coroutines will have > terminated.
Ok, I see my confusion, it's only because of the "receiving" flag which actually means "waiting for reply". Your patch is okay. Paolo > Once nbd_client_detach_aio_context() is called > ioc->read_coroutine/write_coroutine are set to NULL. At that point any > remaining coroutine doing I/O on ioc will be in trouble.