From patchwork Fri Feb 7 16:12:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 318098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 28FD42C14E8 for ; Sat, 8 Feb 2014 03:13:50 +1100 (EST) Received: from localhost ([::1]:42400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBo3n-0004MA-Nf for incoming@patchwork.ozlabs.org; Fri, 07 Feb 2014 11:13:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBo3J-0004H8-JC for qemu-devel@nongnu.org; Fri, 07 Feb 2014 11:13:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBo3D-0003XH-AF for qemu-devel@nongnu.org; Fri, 07 Feb 2014 11:13:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBo3C-0003XA-Rm for qemu-devel@nongnu.org; Fri, 07 Feb 2014 11:13:11 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s17GD8B8021675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 7 Feb 2014 11:13:09 -0500 Received: from dhcp-200-207.str.redhat.com (ovpn-116-68.ams2.redhat.com [10.36.116.68]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s17GD1JT001329; Fri, 7 Feb 2014 11:13:06 -0500 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Fri, 7 Feb 2014 17:12:57 +0100 Message-Id: <1391789578-19601-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1391789578-19601-1-git-send-email-kwolf@redhat.com> References: <1391789578-19601-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, lersek@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 2/3] block: bdrv_aligned_pwritev: Assert overlap range 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 This adds assertions that the request that we actually end up passing to the block driver (which includes RMW data and has therefore potentially been rounded to alignment boundaries) is fully covered by the overlap_{offset,size} fields of the associated BdrvTrackedRequest. Suggested-by: Laszlo Ersek Signed-off-by: Kevin Wolf --- block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block.c b/block.c index c1d1f74..a027823 100644 --- a/block.c +++ b/block.c @@ -3134,6 +3134,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, waited = wait_serialising_requests(req); assert(!waited || !req->serialising); + assert(req->overlap_offset <= offset); + assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);