From patchwork Tue Apr 29 15:03:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Booth X-Patchwork-Id: 343865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1C8591400A0 for ; Wed, 30 Apr 2014 01:06:35 +1000 (EST) Received: from localhost ([::1]:50435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf9c8-0007oG-OG for incoming@patchwork.ozlabs.org; Tue, 29 Apr 2014 11:06:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf9Zx-0003Rz-7w for qemu-devel@nongnu.org; Tue, 29 Apr 2014 11:04:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf9Zr-0001aE-3i for qemu-devel@nongnu.org; Tue, 29 Apr 2014 11:04:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf9Zq-0001a1-SV for qemu-devel@nongnu.org; Tue, 29 Apr 2014 11:04:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3TF47D7002435 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 29 Apr 2014 11:04:08 -0400 Received: from t520.com (vpn1-4-184.ams2.redhat.com [10.36.4.184]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s3TF3pcj023636; Tue, 29 Apr 2014 11:04:06 -0400 From: Matthew Booth To: qemu-devel@nongnu.org Date: Tue, 29 Apr 2014 16:03:32 +0100 Message-Id: <1398783812-32535-9-git-send-email-mbooth@redhat.com> In-Reply-To: <1398783812-32535-1-git-send-email-mbooth@redhat.com> References: <1398783812-32535-1-git-send-email-mbooth@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, peter.maydell@linaro.org, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 8/8] curl: Fix hang reading from slow connections X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- block/curl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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))