diff options
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 8c60a6f06..655799c6a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -300,7 +300,10 @@ static int qcow2_open(BlockDriverState *bs, int flags) if (!bs->read_only && s->autoclear_features != 0) { s->autoclear_features = 0; - qcow2_update_header(bs); + ret = qcow2_update_header(bs); + if (ret < 0) { + goto fail; + } } /* Check support for various header values */ @@ -1011,11 +1014,6 @@ fail: static int qcow2_change_backing_file(BlockDriverState *bs, const char *backing_file, const char *backing_fmt) { - /* Backing file format doesn't make sense without a backing file */ - if (backing_fmt && !backing_file) { - return -EINVAL; - } - pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: ""); pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: ""); @@ -1192,7 +1190,10 @@ static int qcow2_create2(const char *filename, int64_t total_size, /* And if we're supposed to preallocate metadata, do that now */ if (prealloc) { + BDRVQcowState *s = bs->opaque; + qemu_co_mutex_lock(&s->lock); ret = preallocate(bs); + qemu_co_mutex_unlock(&s->lock); if (ret < 0) { goto out; } |