Skip to content

block: Fix bdrv_open*() calls from coroutine context

Kevin Wolf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13block-coroutine-wrapper: Introduce no_co_wrapperinclude/block/block-common.h scripts/block-coroutine-wrapper.py+86 -110 replies
2/13block: Create no_co_wrappers for open functionsblock/meson.build include/block/block-global-state.h include/sysemu/block-backend-global-state.h+44 -130 replies
3/13luks: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/crypto.c+5 -50 replies
4/13parallels: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/parallels.c+5 -50 replies
5/13qcow: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/qcow.c+5 -50 replies
6/13qcow2: Fix open/create to open images with no_co_wrapperblock/qcow2.c+22 -210 replies
7/13qed: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/qed.c+5 -50 replies
8/13vdi: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/vdi.c+5 -50 replies
9/13vhdx: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/vhdx.c+5 -50 replies
10/13vmdk: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/vmdk.c+12 -100 replies
11/13vpc: Fix .bdrv_co_create(_opts) to open images with no_co_wrapperblock/vpc.c+5 -50 replies
12/13block: Fix bdrv_co_create_opts_simple() to open images with no_co_wrapperblock.c+2 -21 reply
13/13block: Assert non-coroutine context for bdrv_open_inherit()block.c+6 -70 replies

Reviews trailers per patch

None of the 13 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEmanuele Giuseppe EspositoHanna Czenczek
SeriesR-b R-b
1/13
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/13] block: Fix bdrv_open*() calls from coroutine context

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(-)
Signature · 1 line
2.38.1