mirror of https://gitee.com/openkylin/qemu.git
gluster: Return bdrv_has_zero_init = 0
GlusterFS volumes can be backed by block devices, in which case bdrv_create() doesn't make sure that the image is zeroed out. It is currently not possibly to detect whether a given image is backed by a file or a block device, and incorrectly assuming that it is zeroed corrupts images during qemu-img convert, so let's err on the side of caution and always return 0. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
0b3f21e6a9
commit
8ab6feec2c
|
@ -574,6 +574,12 @@ static void qemu_gluster_close(BlockDriverState *bs)
|
|||
glfs_fini(s->glfs);
|
||||
}
|
||||
|
||||
static int qemu_gluster_has_zero_init(BlockDriverState *bs)
|
||||
{
|
||||
/* GlusterFS volume could be backed by a block device */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static QEMUOptionParameter qemu_gluster_create_options[] = {
|
||||
{
|
||||
.name = BLOCK_OPT_SIZE,
|
||||
|
@ -595,6 +601,7 @@ static BlockDriver bdrv_gluster = {
|
|||
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
||||
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
||||
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
||||
.bdrv_has_zero_init = qemu_gluster_has_zero_init,
|
||||
.create_options = qemu_gluster_create_options,
|
||||
};
|
||||
|
||||
|
@ -610,6 +617,7 @@ static BlockDriver bdrv_gluster_tcp = {
|
|||
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
||||
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
||||
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
||||
.bdrv_has_zero_init = qemu_gluster_has_zero_init,
|
||||
.create_options = qemu_gluster_create_options,
|
||||
};
|
||||
|
||||
|
@ -625,6 +633,7 @@ static BlockDriver bdrv_gluster_unix = {
|
|||
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
||||
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
||||
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
||||
.bdrv_has_zero_init = qemu_gluster_has_zero_init,
|
||||
.create_options = qemu_gluster_create_options,
|
||||
};
|
||||
|
||||
|
@ -640,6 +649,7 @@ static BlockDriver bdrv_gluster_rdma = {
|
|||
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
||||
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
||||
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
||||
.bdrv_has_zero_init = qemu_gluster_has_zero_init,
|
||||
.create_options = qemu_gluster_create_options,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue