From 0d51b4debee6fb322751a57097a1d675c7a7c38d Mon Sep 17 00:00:00 2001 From: Asias He Date: Thu, 22 Aug 2013 15:24:14 +0800 Subject: block: Introduce bs->zero_beyond_eof In 4146b46c42e0989cb5842e04d88ab6ccb1713a48 (block: Produce zeros when protocols reading beyond end of file), we break qemu-iotests ./check -qcow2 022. This happens because qcow2 temporarily sets ->growable = 1 for vmstate accesses (which are stored beyond the end of regular image data). We introduce the bs->zero_beyond_eof to allow qcow2_load_vmstate() to disable ->zero_beyond_eof temporarily in addition to enable ->growable. [Since the broken patch "block: Produce zeros when protocols reading beyond end of file" has not been merged yet, I have applied this fix *first* and will then apply the next patch to keep the tree bisectable. -- Stefan] Suggested-by: Stefan Hajnoczi Signed-off-by: Asias He Signed-off-by: Stefan Hajnoczi --- block/qcow2.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block/qcow2.c') diff --git a/block/qcow2.c b/block/qcow2.c index 42ea7ec76d..78097e5173 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1722,12 +1722,15 @@ static int qcow2_load_vmstate(BlockDriverState *bs, uint8_t *buf, { BDRVQcowState *s = bs->opaque; int growable = bs->growable; + bool zero_beyond_eof = bs->zero_beyond_eof; int ret; BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_LOAD); bs->growable = 1; + bs->zero_beyond_eof = false; ret = bdrv_pread(bs, qcow2_vm_state_offset(s) + pos, buf, size); bs->growable = growable; + bs->zero_beyond_eof = zero_beyond_eof; return ret; } -- cgit v1.2.1