[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 3/7] curl: avoid recursive locking of BDRVCURLSt
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH 3/7] curl: avoid recursive locking of BDRVCURLState mutex |
Date: |
Wed, 10 May 2017 18:38:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 10.05.2017 16:32, Paolo Bonzini wrote:
> The curl driver has a ugly hack where, if it cannot find an empty CURLState,
> it just uses aio_poll to wait for one to be empty. This is probably
> buggy when used together with dataplane, and the simplest way to fix it
> is to use coroutines instead.
>
> A more immediate effect of the bug however is that it can cause a
> recursive call to curl_readv_bh_cb and recursively taking the
> BDRVCURLState mutex. This causes a deadlock.
>
> The fix is to unlock the mutex around aio_poll, but for cleanliness we
> should also take the mutex around all calls to curl_init_state, even if
> reaching the unlock/lock pair is impossible. The same is true for
> curl_clean_state.
>
> Reported-by: Richard W.M. Jones <address@hidden>
> Cc: address@hidden
> Cc: address@hidden
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> block/curl.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
Reviewed-by: Max Reitz <address@hidden>
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v2 0/7] curl: locking cleanups/fixes, coroutine conversion, remove aio_poll, Paolo Bonzini, 2017/05/10
- [Qemu-block] [PATCH 1/7] curl: strengthen assertion in curl_clean_state, Paolo Bonzini, 2017/05/10
- [Qemu-block] [PATCH 2/7] curl: never invoke callbacks with s->mutex held, Paolo Bonzini, 2017/05/10
- [Qemu-block] [PATCH 3/7] curl: avoid recursive locking of BDRVCURLState mutex, Paolo Bonzini, 2017/05/10
- [Qemu-block] [PATCH 4/7] curl: split curl_find_state/curl_init_state, Paolo Bonzini, 2017/05/10
- [Qemu-block] [PATCH 5/7] curl: convert CURLAIOCB to byte values, Paolo Bonzini, 2017/05/10