From: Matthew Booth Date: Tue, 29 Apr 2014 15:03:32 +0000 (+0100) Subject: curl: Fix hang reading from slow connections X-Git-Tag: qemu-xen-4.6.0-rc1~480^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b7079df4100069959f4e9d90d5cb5ba7d4ebbf1a;p=qemu-upstream-4.6-testing.git curl: Fix hang reading from slow connections When receiving a new aio read request, we first look for an existing transaction whose range will cover the read request by the time it completes. However, we weren't checking that the existing transaction was still active. If it had timed out, we were adding the request to a transaction which would never complete and had already been cancelled, resulting in a hang. Signed-off-by: Matthew Booth Tested-by: Richard W.M. Jones Signed-off-by: Kevin Wolf --- diff --git a/block/curl.c b/block/curl.c index 16e7db8ee..d2f1084b9 100644 --- a/block/curl.c +++ b/block/curl.c @@ -220,7 +220,8 @@ static int curl_find_buf(BDRVCURLState *s, size_t start, size_t len, } // Wait for unfinished chunks - if ((start >= state->buf_start) && + if (state->in_use && + (start >= state->buf_start) && (start <= buf_fend) && (end >= state->buf_start) && (end <= buf_fend))