cryptospore / rpms / qemu-kvm

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