yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From 34593324ec77e3f92e27645540ed935767283dc5 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 7 Feb 2014 15:35:56 +0100
Subject: [PATCH 36/37] block: bdrv_aligned_pwritev: Assert overlap range

Message-id: <1392117622-28812-36-git-send-email-kwolf@redhat.com>
Patchwork-id: 57200
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 36/37] block: bdrv_aligned_pwritev: Assert overlap range
Bugzilla: 748906
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>

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 <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 2 ++
 1 file changed, 2 insertions(+)
---
 block.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index d063924..b878c8b 100644
--- a/block.c
+++ b/block.c
@@ -2980,6 +2980,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);
 
     if (flags & BDRV_REQ_ZERO_WRITE) {
         BLKDBG_EVENT(bs, BLKDBG_PWRITEV_ZERO);
-- 
1.7.1