From c743849bee7333c7ef256b7e12e34ed6f907064f Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 14 Jan 2011 22:44:33 +0000 Subject: qed: Refuse to create images on block devices QED relies on the underlying filesystem to extend the file and maintain its size. Check that images are not created on a block device. Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/qed.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'block') diff --git a/block/qed.c b/block/qed.c index 085c4f2210..a46f9ef419 100644 --- a/block/qed.c +++ b/block/qed.c @@ -469,6 +469,12 @@ static int qed_create(const char *filename, uint32_t cluster_size, return ret; } + /* File must start empty and grow, check truncate is supported */ + ret = bdrv_truncate(bs, 0); + if (ret < 0) { + goto out; + } + if (backing_file) { header.features |= QED_F_BACKING_FILE; header.backing_filename_offset = sizeof(le_header); -- cgit v1.2.3