9ae3a8
From 34593324ec77e3f92e27645540ed935767283dc5 Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Fri, 7 Feb 2014 15:35:56 +0100
9ae3a8
Subject: [PATCH 36/37] block: bdrv_aligned_pwritev: Assert overlap range
9ae3a8
9ae3a8
Message-id: <1392117622-28812-36-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 57200
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 36/37] block: bdrv_aligned_pwritev: Assert overlap range
9ae3a8
Bugzilla: 748906
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
This adds assertions that the request that we actually end up passing to
9ae3a8
the block driver (which includes RMW data and has therefore potentially
9ae3a8
been rounded to alignment boundaries) is fully covered by the
9ae3a8
overlap_{offset,size} fields of the associated BdrvTrackedRequest.
9ae3a8
9ae3a8
Suggested-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 block.c | 2 ++
9ae3a8
 1 file changed, 2 insertions(+)
9ae3a8
---
9ae3a8
 block.c |    2 ++
9ae3a8
 1 files changed, 2 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index d063924..b878c8b 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -2980,6 +2980,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,
9ae3a8
 
9ae3a8
     waited = wait_serialising_requests(req);
9ae3a8
     assert(!waited || !req->serialising);
9ae3a8
+    assert(req->overlap_offset <= offset);
9ae3a8
+    assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
9ae3a8
 
9ae3a8
     if (flags & BDRV_REQ_ZERO_WRITE) {
9ae3a8
         BLKDBG_EVENT(bs, BLKDBG_PWRITEV_ZERO);
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8