[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 3/5] block: Simplify bdrv_reopen_abort()
From: |
Alberto Garcia |
Subject: |
[Qemu-block] [PATCH 3/5] block: Simplify bdrv_reopen_abort() |
Date: |
Fri, 29 Jun 2018 14:37:01 +0300 |
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 <address@hidden>
---
block.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/block.c b/block.c
index 5aaed424b9..48e8f4814c 100644
--- a/block.c
+++ b/block.c
@@ -3060,9 +3060,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);
@@ -3351,8 +3352,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);
}
--
2.11.0
- [Qemu-block] [PATCH 0/5] Some bs->options fixes, Alberto Garcia, 2018/06/29
- [Qemu-block] [PATCH 5/5] block: Simplify append_open_options(), Alberto Garcia, 2018/06/29
- [Qemu-block] [PATCH 4/5] block: Update bs->options if bdrv_reopen() succeeds, Alberto Garcia, 2018/06/29
- [Qemu-block] [PATCH 1/5] qdict: Make qdict_extract_subqdict() accept dst = NULL, Alberto Garcia, 2018/06/29
- [Qemu-block] [PATCH 3/5] block: Simplify bdrv_reopen_abort(),
Alberto Garcia <=
- [Qemu-block] [PATCH 2/5] block: Remove children options from bs->{options, explicit_options}, Alberto Garcia, 2018/06/29