qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] block: Fix bdrv_open*() calls from coroutine context
@ 2023-01-26 17:24 Kevin Wolf
  2023-01-26 17:24 ` [PATCH 01/13] block-coroutine-wrapper: Introduce no_co_wrapper Kevin Wolf
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: Kevin Wolf @ 2023-01-26 17:24 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, hreitz, eesposit, pbonzini, qemu-devel

bdrv_open*() must not be called from coroutine context, amongst others
because it modifies the block graph. However, some functions - in
particular all .bdrv_co_create* implementations of image formats - do
call it from coroutine context. This is already wrong today, but when we
add locking, it actually becomes visible.

This series adds no_co_wrapper functions, which are automatically
generated wrappers that run in coroutine context and use a BH to call
the wrapped function outside of coroutine context. It then uses these
wrappers to fix the problematic bdrv_open*() calls.

Kevin Wolf (13):
  block-coroutine-wrapper: Introduce no_co_wrapper
  block: Create no_co_wrappers for open functions
  luks: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  parallels: Fix .bdrv_co_create(_opts) to open images with
    no_co_wrapper
  qcow: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  qcow2: Fix open/create to open images with no_co_wrapper
  qed: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  vdi: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  vhdx: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  vmdk: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  vpc: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper
  block: Fix bdrv_co_create_opts_simple() to open images with
    no_co_wrapper
  block: Assert non-coroutine context for bdrv_open_inherit()

 include/block/block-common.h                | 14 ++++
 include/block/block-global-state.h          | 35 ++++++---
 include/sysemu/block-backend-global-state.h | 21 +++++-
 block.c                                     | 17 ++---
 block/crypto.c                              | 10 +--
 block/parallels.c                           | 10 +--
 block/qcow.c                                | 10 +--
 block/qcow2.c                               | 43 +++++------
 block/qed.c                                 | 10 +--
 block/vdi.c                                 | 10 +--
 block/vhdx.c                                | 10 +--
 block/vmdk.c                                | 22 +++---
 block/vpc.c                                 | 10 +--
 scripts/block-coroutine-wrapper.py          | 83 ++++++++++++++++++---
 block/meson.build                           |  1 +
 15 files changed, 207 insertions(+), 99 deletions(-)

-- 
2.38.1



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-02-13 11:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-26 17:24 [PATCH 00/13] block: Fix bdrv_open*() calls from coroutine context Kevin Wolf
2023-01-26 17:24 ` [PATCH 01/13] block-coroutine-wrapper: Introduce no_co_wrapper Kevin Wolf
2023-01-26 17:24 ` [PATCH 02/13] block: Create no_co_wrappers for open functions Kevin Wolf
2023-01-26 17:24 ` [PATCH 03/13] luks: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper Kevin Wolf
2023-01-26 17:24 ` [PATCH 04/13] parallels: " Kevin Wolf
2023-01-26 17:24 ` [PATCH 05/13] qcow: " Kevin Wolf
2023-01-26 17:24 ` [PATCH 06/13] qcow2: Fix open/create " Kevin Wolf
2023-01-26 17:24 ` [PATCH 07/13] qed: Fix .bdrv_co_create(_opts) " Kevin Wolf
2023-01-26 17:24 ` [PATCH 08/13] vdi: " Kevin Wolf
2023-01-26 17:24 ` [PATCH 09/13] vhdx: " Kevin Wolf
2023-01-26 17:24 ` [PATCH 10/13] vmdk: " Kevin Wolf
2023-01-26 17:24 ` [PATCH 11/13] vpc: " Kevin Wolf
2023-01-26 17:24 ` [PATCH 12/13] block: Fix bdrv_co_create_opts_simple() " Kevin Wolf
2023-02-03 17:04   ` Eric Blake
2023-01-26 17:24 ` [PATCH 13/13] block: Assert non-coroutine context for bdrv_open_inherit() Kevin Wolf
2023-01-27  8:30 ` [PATCH 00/13] block: Fix bdrv_open*() calls from coroutine context Emanuele Giuseppe Esposito
2023-02-07 15:07 ` Hanna Czenczek
2023-02-13 11:26 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).