aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2018-06-29 14:37:01 +0300
committerKevin Wolf <kwolf@redhat.com>2018-08-15 12:50:39 +0200
commit1bab38e7bd29347aca642c55a1de91ec6680efce (patch)
tree91d7a0a5123aff8b29e1dac6ba6c10591475b388
parent2f624b80ba67f19edb3f7c5bc27cddc3c844e443 (diff)
downloadqemu-1bab38e7bd29347aca642c55a1de91ec6680efce.zip
qemu-1bab38e7bd29347aca642c55a1de91ec6680efce.tar.gz
qemu-1bab38e7bd29347aca642c55a1de91ec6680efce.tar.bz2
block: Simplify bdrv_reopen_abort()
If a bdrv_reopen_multiple() call fails, then the explicit_options QDict has to be deleted for every entry in the reopen queue. This must happen regardless of whether that entry's bdrv_reopen_prepare() call succeeded or not. This patch simplifies the cleanup code a bit. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/block.c b/block.c
index a8fbab3..e82cfa6 100644
--- a/block.c
+++ b/block.c
@@ -3050,9 +3050,10 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **er
cleanup:
QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
- if (ret && bs_entry->prepared) {
- bdrv_reopen_abort(&bs_entry->state);
- } else if (ret) {
+ if (ret) {
+ if (bs_entry->prepared) {
+ bdrv_reopen_abort(&bs_entry->state);
+ }
qobject_unref(bs_entry->state.explicit_options);
}
qobject_unref(bs_entry->state.options);
@@ -3341,8 +3342,6 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
drv->bdrv_reopen_abort(reopen_state);
}
- qobject_unref(reopen_state->explicit_options);
-
bdrv_abort_perm_update(reopen_state->bs);
}