From patchwork Thu Jan 10 09:21:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 210955 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C6C262C0311 for ; Thu, 10 Jan 2013 20:21:34 +1100 (EST) Received: from localhost ([::1]:48039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtEKK-0003wt-1m for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2013 04:21:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtEKA-0003wc-Oo for qemu-devel@nongnu.org; Thu, 10 Jan 2013 04:21:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtEK8-0000DF-7L for qemu-devel@nongnu.org; Thu, 10 Jan 2013 04:21:22 -0500 Received: from ssl.dlhnet.de ([91.198.192.8]:50353 helo=ssl.dlh.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtEK8-0000DA-0o for qemu-devel@nongnu.org; Thu, 10 Jan 2013 04:21:20 -0500 Received: from localhost (localhost [127.0.0.1]) by ssl.dlh.net (Postfix) with ESMTP id 40CA614D252; Thu, 10 Jan 2013 10:21:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at ssl.dlh.net Received: from ssl.dlh.net ([127.0.0.1]) by localhost (ssl.dlh.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 55SuWTiXAFVf; Thu, 10 Jan 2013 10:21:17 +0100 (CET) Received: from [172.21.12.60] (unknown [82.141.1.226]) by ssl.dlh.net (Postfix) with ESMTPSA id DF64114CFE3; Thu, 10 Jan 2013 10:21:17 +0100 (CET) Message-ID: <50EE8810.7080507@dlhnet.de> Date: Thu, 10 Jan 2013 10:21:20 +0100 From: Peter Lieven User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "qemu-devel@nongnu.org" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 91.198.192.8 Cc: kwolf@redhat.com, Paolo Bonzini Subject: [Qemu-devel] [PATCH] block: init bs->io_base correctly to avoid locking 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 If io_limits are specified during runtime that exceed the number of operations in flight bs->io_base is not initialized in the else statement in bdrv_exceed_io_limits(). The wait time calculated in bdrv_exceed_{bps,iops}_limits is thus totally wrong and the machine locks. Signed-off-by: Peter Lieven --- block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block.c b/block.c index 4e28c55..309aa85 100644 --- a/block.c +++ b/block.c @@ -159,6 +159,10 @@ void bdrv_io_limits_enable(BlockDriverState *bs) bs->slice_start = qemu_get_clock_ns(vm_clock); bs->slice_end = bs->slice_start + bs->slice_time; memset(&bs->io_base, 0, sizeof(bs->io_base)); + bs->io_base.bytes[0] = bs->nr_bytes[0]; + bs->io_base.bytes[1] = bs->nr_bytes[1]; + bs->io_base.ios[0] = bs->nr_ops[0]; + bs->io_base.ios[1] = bs->nr_ops[1]; bs->io_limits_enabled = true; }