BDRV_BLOCK_RAW makes generic bdrv_co_block_status to fallthrough to returned file. But is it correct behavior at all? If returned file itself has a backing file, we may report as totally unallocated and area which actually has data in bottom backing file.
So, mirroring of qcow2 under raw-format is broken. Which is illustrated by following commit with a test. Let's make raw-format behave more correctly returning BDRV_BLOCK_DATA. Suggested-by: Max Reitz <mre...@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> --- block/raw-format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/raw-format.c b/block/raw-format.c index bffd424dd0..a273ee2387 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -275,7 +275,7 @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs, *pnum = bytes; *file = bs->file->bs; *map = offset + s->offset; - return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID; + return BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_RECURSE; } static int coroutine_fn raw_co_pwrite_zeroes(BlockDriverState *bs, -- 2.18.0