yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 188c4737c54787bbd734c628121f7f0e4f833cd1 Mon Sep 17 00:00:00 2001
9ae3a8
From: Richard Jones <rjones@redhat.com>
9ae3a8
Date: Thu, 11 Jun 2015 11:40:18 +0200
9ae3a8
Subject: [PATCH 18/30] curl: Fix hang reading from slow connections
9ae3a8
9ae3a8
Message-id: <1434022828-13037-12-git-send-email-rjones@redhat.com>
9ae3a8
Patchwork-id: 65847
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm v3 PATCH 11/21] curl: Fix hang reading from slow connections
9ae3a8
Bugzilla: 1226684
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
From: Matthew Booth <mbooth@redhat.com>
9ae3a8
9ae3a8
When receiving a new aio read request, we first look for an existing
9ae3a8
transaction whose range will cover the read request by the time it
9ae3a8
completes. However, we weren't checking that the existing transaction
9ae3a8
was still active. If it had timed out, we were adding the request to a
9ae3a8
transaction which would never complete and had already been cancelled,
9ae3a8
resulting in a hang.
9ae3a8
9ae3a8
Signed-off-by: Matthew Booth <mbooth@redhat.com>
9ae3a8
Tested-by: Richard W.M. Jones <rjones@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
9ae3a8
Upstream-status: b7079df4100069959f4e9d90d5cb5ba7d4ebbf1a
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/curl.c | 3 ++-
9ae3a8
 1 file changed, 2 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/block/curl.c b/block/curl.c
9ae3a8
index 41cf015..1bff71a 100644
9ae3a8
--- a/block/curl.c
9ae3a8
+++ b/block/curl.c
9ae3a8
@@ -220,7 +220,8 @@ static int curl_find_buf(BDRVCURLState *s, size_t start, size_t len,
9ae3a8
         }
9ae3a8
 
9ae3a8
         // Wait for unfinished chunks
9ae3a8
-        if ((start >= state->buf_start) &&
9ae3a8
+        if (state->in_use &&
9ae3a8
+            (start >= state->buf_start) &&
9ae3a8
             (start <= buf_fend) &&
9ae3a8
             (end >= state->buf_start) &&
9ae3a8
             (end <= buf_fend))
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8