提交 c743849b 编写于 作者: S Stefan Hajnoczi 提交者: Kevin Wolf

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: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 e6184690
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册