On 10/11/2016 06:47 PM, Paolo Bonzini wrote:
the free_sema->queue head, so set free_sema->holder as
>revelant coroutine.
NBD is using the CoMutex in a way that wasn't anticipated.  The simplest
fix is to change it to CoQueue, which is like a condition variable.
Instead of locking if in_flight >= MAX_NBD_REQUESTS - 1, wait on the
queue while in_flight == MAX_NBD_REQUESTS.  Instead of unlocking, use
qemu_co_queue_next to wake up one request.


Thanks for your explanation! will send out a patch later.


Thanks
        -Xie

Thanks for the report!

Paolo

>For example if there are N(N=26 and MAX_NBD_REQUESTS=16) nbd write
>requests, so we'll invoke nbd_client_co_pwritev 26 times.
>time     request No   Actions
>1         1           in_flight=1, Coroutine=C1
>2         2           in_flight=2, Coroutine=C2



Reply via email to