From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, hreitz@redhat.com, stefanha@redhat.com,
f.ebner@proxmox.com, qemu-devel@nongnu.org
Subject: [PATCH 0/8] block: Honour graph read lock even in the main thread
Date: Wed, 10 May 2023 22:35:53 +0200 [thread overview]
Message-ID: <20230510203601.418015-1-kwolf@redhat.com> (raw)
Fiona asked why it's correct that bdrv_graph_co_rd_lock/unlock() do
nothing if qemu_in_main_thread() returns true. As far as I can tell,
it's not correct. The coroutine can yield while it believes to have the
lock, and then the main loop can call some code that takes a write lock
without waiting for the coroutine to finish.
So this series - or more specifically the last patch - fixes this
problem by enabling the locking even in the main thread. The patches
before this are fixes for bugs that we hadn't discovered while they were
only triggered with iothreads, and which are necessary so that all test
cases still pass after the final patch.
Kevin Wolf (8):
block: Call .bdrv_co_create(_opts) unlocked
block/export: Fix null pointer dereference in error path
qcow2: Unlock the graph in qcow2_do_open() where necessary
qemu-img: Take graph lock more selectively
test-bdrv-drain: Take graph lock more selectively
test-bdrv-drain: Call bdrv_co_unref() in coroutine context
blockjob: Adhere to rate limit even when reentered early
graph-lock: Honour read locks even in the main thread
include/block/block-global-state.h | 8 +++---
include/block/block_int-common.h | 4 +--
include/block/blockjob_int.h | 14 +++++++---
block.c | 1 -
block/commit.c | 7 ++---
block/create.c | 1 -
block/crypto.c | 25 +++++++++--------
block/export/export.c | 6 +++--
block/graph-lock.c | 10 -------
block/mirror.c | 23 +++++++---------
block/parallels.c | 6 ++---
block/qcow.c | 6 ++---
block/qcow2.c | 43 +++++++++++++++++++++---------
block/qed.c | 6 ++---
block/raw-format.c | 2 +-
block/stream.c | 7 ++---
block/vdi.c | 11 ++++----
block/vhdx.c | 8 +++---
block/vmdk.c | 27 +++++++++----------
block/vpc.c | 6 ++---
blockjob.c | 22 +++++++++++++--
qemu-img.c | 5 ++--
tests/unit/test-bdrv-drain.c | 6 ++---
23 files changed, 138 insertions(+), 116 deletions(-)
--
2.40.1
next reply other threads:[~2023-05-10 20:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 20:35 Kevin Wolf [this message]
2023-05-10 20:35 ` [PATCH 1/8] block: Call .bdrv_co_create(_opts) unlocked Kevin Wolf
2023-05-12 16:12 ` Eric Blake
2023-05-15 16:19 ` Kevin Wolf
2023-05-15 21:08 ` Eric Blake
2023-05-10 20:35 ` [PATCH 2/8] block/export: Fix null pointer dereference in error path Kevin Wolf
2023-05-12 15:31 ` Peter Maydell
2023-05-12 16:16 ` Eric Blake
2023-05-12 18:46 ` Eric Blake
2023-05-10 20:35 ` [PATCH 3/8] qcow2: Unlock the graph in qcow2_do_open() where necessary Kevin Wolf
2023-05-12 16:19 ` Eric Blake
2023-05-10 20:35 ` [PATCH 4/8] qemu-img: Take graph lock more selectively Kevin Wolf
2023-05-12 16:20 ` Eric Blake
2023-05-10 20:35 ` [PATCH 5/8] test-bdrv-drain: " Kevin Wolf
2023-05-12 16:26 ` Eric Blake
2023-05-10 20:35 ` [PATCH 6/8] test-bdrv-drain: Call bdrv_co_unref() in coroutine context Kevin Wolf
2023-05-12 16:27 ` Eric Blake
2023-05-10 20:36 ` [PATCH 7/8] blockjob: Adhere to rate limit even when reentered early Kevin Wolf
2023-05-12 16:35 ` Eric Blake
2023-05-10 20:36 ` [PATCH 8/8] graph-lock: Honour read locks even in the main thread Kevin Wolf
2023-05-12 16:37 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230510203601.418015-1-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=f.ebner@proxmox.com \
--cc=hreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).