From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLvZV-0003Y8-1r for qemu-devel@nongnu.org; Wed, 20 Jan 2016 11:25:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLvZU-0006x5-AU for qemu-devel@nongnu.org; Wed, 20 Jan 2016 11:25:24 -0500 From: Kevin Wolf Date: Wed, 20 Jan 2016 17:24:57 +0100 Message-Id: <1453307106-28330-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1453307106-28330-1-git-send-email-kwolf@redhat.com> References: <1453307106-28330-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 08/17] block: Assert no write requests under BDRV_O_INCOMING List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org As long as BDRV_O_INCOMING is set, the image file is only opened so we have a file descriptor for it. We're definitely not supposed to modify the image, it's still owned by the migration source. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/io.c b/block/io.c index 707c04b..2372994 100644 --- a/block/io.c +++ b/block/io.c @@ -1301,6 +1301,7 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, if (bs->read_only) { return -EPERM; } + assert(!(bs->open_flags & BDRV_O_INCOMING)); ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { @@ -2462,6 +2463,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, } else if (bs->read_only) { return -EPERM; } + assert(!(bs->open_flags & BDRV_O_INCOMING)); /* Do nothing if disabled. */ if (!(bs->open_flags & BDRV_O_UNMAP)) { -- 1.8.3.1