diff mbox

[PULL,31/31] curl: Fix hang reading from slow connections

Message ID 1398882243-14783-32-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf April 30, 2014, 6:24 p.m. UTC
From: Matthew Booth <mbooth@redhat.com>

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>
---
 block/curl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/block/curl.c b/block/curl.c
index 16e7db8..d2f1084 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))