qemu/block-Simplify-qmp_block_resize-error-pa.patch
Bruce Rogers 5b17093cb1 Accepting request 860516 from home:bfrogers:branches:Virtualization
- Fix crash when spice used and the qemu-audio-spice package isn't
  installed (boo#1180210)
  audio-add-sanity-check.patch
- Add some stable patches from upstream
  block-Fix-deadlock-in-bdrv_co_yield_to_d.patch
  block-Fix-locking-in-qmp_block_resize.patch
  block-nfs-fix-int-overflow-in-nfs_client.patch
  block-Simplify-qmp_block_resize-error-pa.patch
  build-no-pie-is-no-functional-linker-fla.patch

OBS-URL: https://build.opensuse.org/request/show/860516
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=599
2021-01-05 17:40:44 +00:00

63 lines
1.9 KiB
Diff

From: Kevin Wolf <kwolf@redhat.com>
Date: Thu, 3 Dec 2020 18:23:09 +0100
Subject: block: Simplify qmp_block_resize() error paths
Git-commit: d9dbf25f9624aac43e4357019bed4422f0b3368d
The only thing that happens after the 'out:' label is blk_unref(blk).
However, blk = NULL in all of the error cases, so instead of jumping to
'out:', we can just return directly.
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20201203172311.68232-2-kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
blockdev.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index fe6fb5dc1d19716fba52e8b900e2..a7f0149d64152651be78f6cd8e61 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2454,7 +2454,7 @@ void coroutine_fn qmp_block_resize(bool has_device, const char *device,
int64_t size, Error **errp)
{
Error *local_err = NULL;
- BlockBackend *blk = NULL;
+ BlockBackend *blk;
BlockDriverState *bs;
AioContext *old_ctx;
@@ -2468,17 +2468,17 @@ void coroutine_fn qmp_block_resize(bool has_device, const char *device,
if (size < 0) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
- goto out;
+ return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
error_setg(errp, QERR_DEVICE_IN_USE, device);
- goto out;
+ return;
}
blk = blk_new_with_bs(bs, BLK_PERM_RESIZE, BLK_PERM_ALL, errp);
if (!blk) {
- goto out;
+ return;
}
bdrv_drained_begin(bs);
@@ -2487,7 +2487,6 @@ void coroutine_fn qmp_block_resize(bool has_device, const char *device,
bdrv_co_leave(bs, old_ctx);
bdrv_drained_end(bs);
-out:
bdrv_co_lock(bs);
blk_unref(blk);
bdrv_co_unlock(bs);