]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
block: move blk_exp_close_all() to qemu_cleanup()
authorSergio Lopez <slp@redhat.com>
Mon, 1 Feb 2021 12:50:32 +0000 (13:50 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 2 Feb 2021 12:23:47 +0000 (13:23 +0100)
Move blk_exp_close_all() from bdrv_close() to qemu_cleanup(), before
bdrv_drain_all_begin().

Export drivers may have coroutines yielding at some point in the block
layer, so we need to shut them down before draining the block layer,
as otherwise they may get stuck blk_wait_while_drained().

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1900505
Signed-off-by: Sergio Lopez <slp@redhat.com>
Message-Id: <20210201125032.44713-3-slp@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
qemu-nbd.c
softmmu/runstate.c
storage-daemon/qemu-storage-daemon.c

diff --git a/block.c b/block.c
index 5c428e1595aee2056da67b70017cd58af1cb886f..4e52b1c588cdc89666be5981d588b8fe8f5710ba 100644 (file)
--- a/block.c
+++ b/block.c
@@ -4435,7 +4435,6 @@ static void bdrv_close(BlockDriverState *bs)
 void bdrv_close_all(void)
 {
     assert(job_next(NULL) == NULL);
-    blk_exp_close_all();
 
     /* Drop references from requests still in flight, such as canceled block
      * jobs whose AIO context has not been polled yet */
index 0d513cb38c88b022691a3893cf48650ea4a84298..608c63e82a255e080b6e28377c4f17d2b851ab0d 100644 (file)
@@ -503,6 +503,7 @@ static const char *socket_activation_validate_opts(const char *device,
 static void qemu_nbd_shutdown(void)
 {
     job_cancel_sync_all();
+    blk_exp_close_all();
     bdrv_close_all();
 }
 
index beee050815db3dc825ad41e70cd7f987f6ef9712..a7fcb603f7110a48fd1746ed46d505a2fe229b2b 100644 (file)
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "audio/audio.h"
 #include "block/block.h"
+#include "block/export.h"
 #include "chardev/char.h"
 #include "crypto/cipher.h"
 #include "crypto/init.h"
@@ -784,6 +785,14 @@ void qemu_cleanup(void)
      */
     migration_shutdown();
 
+    /*
+     * Close the exports before draining the block layer. The export
+     * drivers may have coroutines yielding on it, so we need to clean
+     * them up before the drain, as otherwise they may be get stuck in
+     * blk_wait_while_drained().
+     */
+    blk_exp_close_all();
+
     /*
      * We must cancel all block jobs while the block layer is drained,
      * or cancelling will be affected by throttling and thus may block
index e0c87edbdd489903e683480b267f8e00c4533d8b..d8d172cc60a66610b49be708c96437aeae365b34 100644 (file)
@@ -314,6 +314,7 @@ int main(int argc, char *argv[])
         main_loop_wait(false);
     }
 
+    blk_exp_close_all();
     bdrv_drain_all_begin();
     bdrv_close_all();