qcow2: Always use error path on writing snapshots
qcow2_write_snapshots does contain a fail label and there is no reason not to use it on some errors; therefore, we should always jump there on error. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
8f730dd24e
commit
37d41f0a04
@ -182,11 +182,12 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
|
|||||||
snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
|
snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
|
||||||
offset = snapshots_offset;
|
offset = snapshots_offset;
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
return offset;
|
ret = offset;
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
ret = bdrv_flush(bs);
|
ret = bdrv_flush(bs);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The snapshot list position has not yet been updated, so these clusters
|
/* The snapshot list position has not yet been updated, so these clusters
|
||||||
@ -194,7 +195,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
|
|||||||
ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset,
|
ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset,
|
||||||
snapshots_size);
|
snapshots_size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user