Blame SOURCES/kvm-block-bdrv_aligned_pwritev-Assert-overlap-range.patch

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