summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Booth2014-04-29 17:03:32 +0200
committerKevin Wolf2014-04-30 16:34:21 +0200
commitb7079df4100069959f4e9d90d5cb5ba7d4ebbf1a (patch)
tree7a6b1c015cd4f9f029c7df3b2fdb42eb0c26c7ee
parentcurl: Ensure all informationals are checked for completion (diff)
downloadqemu-b7079df4100069959f4e9d90d5cb5ba7d4ebbf1a.tar.gz
qemu-b7079df4100069959f4e9d90d5cb5ba7d4ebbf1a.tar.xz
qemu-b7079df4100069959f4e9d90d5cb5ba7d4ebbf1a.zip
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 <mbooth@redhat.com> Tested-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/curl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/curl.c b/block/curl.c
index 16e7db8eea..d2f1084b91 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))