Blame SOURCES/kvm-block-Simplify-bdrv_reopen_abort.patch

7711c0
From e790236fc17d7ceb73571bdd5f62c15693e7a071 Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Fri, 15 Mar 2019 18:09:59 +0100
7711c0
Subject: [PATCH 003/163] block: Simplify bdrv_reopen_abort()
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20190315181010.14964-4-kwolf@redhat.com>
7711c0
Patchwork-id: 84880
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 03/14] block: Simplify bdrv_reopen_abort()
7711c0
Bugzilla: 1685989
7711c0
RH-Acked-by: John Snow <jsnow@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Alberto Garcia <berto@igalia.com>
7711c0
7711c0
If a bdrv_reopen_multiple() call fails, then the explicit_options
7711c0
QDict has to be deleted for every entry in the reopen queue. This must
7711c0
happen regardless of whether that entry's bdrv_reopen_prepare() call
7711c0
succeeded or not.
7711c0
7711c0
This patch simplifies the cleanup code a bit.
7711c0
7711c0
Signed-off-by: Alberto Garcia <berto@igalia.com>
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
(cherry picked from commit 1bab38e7bd29347aca642c55a1de91ec6680efce)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block.c | 9 ++++-----
7711c0
 1 file changed, 4 insertions(+), 5 deletions(-)
7711c0
7711c0
diff --git a/block.c b/block.c
7711c0
index ccf9acb..c3148cc 100644
7711c0
--- a/block.c
7711c0
+++ b/block.c
7711c0
@@ -3083,9 +3083,10 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **er
7711c0
 
7711c0
 cleanup:
7711c0
     QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
7711c0
-        if (ret && bs_entry->prepared) {
7711c0
-            bdrv_reopen_abort(&bs_entry->state);
7711c0
-        } else if (ret) {
7711c0
+        if (ret) {
7711c0
+            if (bs_entry->prepared) {
7711c0
+                bdrv_reopen_abort(&bs_entry->state);
7711c0
+            }
7711c0
             qobject_unref(bs_entry->state.explicit_options);
7711c0
         }
7711c0
         qobject_unref(bs_entry->state.options);
7711c0
@@ -3374,8 +3375,6 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
7711c0
         drv->bdrv_reopen_abort(reopen_state);
7711c0
     }
7711c0
 
7711c0
-    qobject_unref(reopen_state->explicit_options);
7711c0
-
7711c0
     bdrv_abort_perm_update(reopen_state->bs);
7711c0
 }
7711c0
 
7711c0
-- 
7711c0
1.8.3.1
7711c0