mirror of
https://github.com/qemu/qemu.git
synced 2025-08-08 08:05:17 +00:00
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>
This commit is contained in:
parent
2f624b80ba
commit
1bab38e7bd
9
block.c
9
block.c
@ -3050,9 +3050,10 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **er
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
|
QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
|
||||||
if (ret && bs_entry->prepared) {
|
if (ret) {
|
||||||
bdrv_reopen_abort(&bs_entry->state);
|
if (bs_entry->prepared) {
|
||||||
} else if (ret) {
|
bdrv_reopen_abort(&bs_entry->state);
|
||||||
|
}
|
||||||
qobject_unref(bs_entry->state.explicit_options);
|
qobject_unref(bs_entry->state.explicit_options);
|
||||||
}
|
}
|
||||||
qobject_unref(bs_entry->state.options);
|
qobject_unref(bs_entry->state.options);
|
||||||
@ -3341,8 +3342,6 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
|
|||||||
drv->bdrv_reopen_abort(reopen_state);
|
drv->bdrv_reopen_abort(reopen_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
qobject_unref(reopen_state->explicit_options);
|
|
||||||
|
|
||||||
bdrv_abort_perm_update(reopen_state->bs);
|
bdrv_abort_perm_update(reopen_state->bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user