From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com, pbonzini@redhat.com,
eesposit@redhat.com, qemu-devel@nongnu.org
Subject: [PATCH 15/20] block: Mark bdrv_co_debug_event() GRAPH_RDLOCK
Date: Tue, 25 Apr 2023 19:31:53 +0200 [thread overview]
Message-ID: <20230425173158.574203-16-kwolf@redhat.com> (raw)
In-Reply-To: <20230425173158.574203-1-kwolf@redhat.com>
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_co_debug_event() need to hold a reader lock for the graph.
Unfortunately we cannot use a co_wrapper_bdrv_rdlock, because the
function is called by mixed functions that run both in coroutine and
non-coroutine context (for example blkdebug_open).
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block-io.h | 9 +++++----
include/block/block_int-common.h | 4 ++--
block.c | 2 ++
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/block/block-io.h b/include/block/block-io.h
index bba7f957e1..1f612ec5bd 100644
--- a/include/block/block-io.h
+++ b/include/block/block-io.h
@@ -205,10 +205,11 @@ void *qemu_try_blockalign0(BlockDriverState *bs, size_t size);
void bdrv_enable_copy_on_read(BlockDriverState *bs);
void bdrv_disable_copy_on_read(BlockDriverState *bs);
-void coroutine_fn bdrv_co_debug_event(BlockDriverState *bs,
- BlkdebugEvent event);
-void co_wrapper_mixed bdrv_debug_event(BlockDriverState *bs,
- BlkdebugEvent event);
+void coroutine_fn GRAPH_RDLOCK
+bdrv_co_debug_event(BlockDriverState *bs, BlkdebugEvent event);
+
+void co_wrapper_mixed_bdrv_rdlock
+bdrv_debug_event(BlockDriverState *bs, BlkdebugEvent event);
#define BLKDBG_EVENT(child, evt) \
do { \
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index ee77903f72..88ce7f9d9e 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -735,8 +735,8 @@ struct BlockDriver {
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_check)(
BlockDriverState *bs, BdrvCheckResult *result, BdrvCheckMode fix);
- void coroutine_fn (*bdrv_co_debug_event)(BlockDriverState *bs,
- BlkdebugEvent event);
+ void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_debug_event)(
+ BlockDriverState *bs, BlkdebugEvent event);
/* io queue for linux-aio */
void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_io_plug)(BlockDriverState *bs);
diff --git a/block.c b/block.c
index a6deaf8ad1..1bc766c778 100644
--- a/block.c
+++ b/block.c
@@ -6399,6 +6399,8 @@ BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs)
void coroutine_fn bdrv_co_debug_event(BlockDriverState *bs, BlkdebugEvent event)
{
IO_CODE();
+ assert_bdrv_graph_readable();
+
if (!bs || !bs->drv || !bs->drv->bdrv_co_debug_event) {
return;
}
--
2.40.0
next prev parent reply other threads:[~2023-04-25 17:33 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 17:31 [PATCH 00/20] Graph locking, part 3 (more block drivers) Kevin Wolf
2023-04-25 17:31 ` [PATCH 01/20] qcow2: Don't call bdrv_getlength() in coroutine_fns Kevin Wolf
2023-04-25 18:37 ` Eric Blake
2023-04-27 11:12 ` Kevin Wolf
2023-04-27 15:07 ` Eric Blake
2023-05-01 15:19 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 02/20] block: Consistently call bdrv_activate() outside coroutine Kevin Wolf
2023-04-25 18:39 ` Eric Blake
2023-05-01 15:21 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 03/20] block: bdrv/blk_co_unref() for calls in coroutine context Kevin Wolf
2023-04-25 20:04 ` Eric Blake
2023-04-27 14:30 ` Paolo Bonzini
2023-04-27 17:00 ` Kevin Wolf
2023-04-27 20:49 ` Paolo Bonzini
2023-05-04 11:18 ` Kevin Wolf
2023-05-01 15:23 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 04/20] block: Don't call no_coroutine_fns in qmp_block_resize() Kevin Wolf
2023-04-25 20:08 ` Eric Blake
2023-04-27 11:15 ` Kevin Wolf
2023-04-27 15:09 ` Eric Blake
2023-05-01 15:24 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 05/20] test-bdrv-drain: Don't modify the graph in coroutines Kevin Wolf
2023-04-25 20:10 ` Eric Blake
2023-05-01 15:30 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 06/20] graph-lock: Add GRAPH_UNLOCKED(_PTR) Kevin Wolf
2023-04-25 20:20 ` Eric Blake
2023-05-01 15:32 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 07/20] graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock Kevin Wolf
2023-04-25 20:36 ` Eric Blake
2023-04-27 11:28 ` Kevin Wolf
2023-04-27 15:15 ` Eric Blake
2023-05-01 15:34 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 08/20] block: .bdrv_open is non-coroutine and unlocked Kevin Wolf
2023-04-25 21:04 ` Eric Blake
2023-05-01 16:01 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 09/20] nbd: Remove nbd_co_flush() wrapper function Kevin Wolf
2023-04-25 21:05 ` Eric Blake
2023-05-01 16:02 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 10/20] nbd: Mark nbd_co_do_establish_connection() and callers GRAPH_RDLOCK Kevin Wolf
2023-04-25 21:07 ` Eric Blake
2023-05-01 18:57 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 11/20] vhdx: Take graph lock for accessing a node's parent list Kevin Wolf
2023-04-25 21:08 ` Eric Blake
2023-05-01 18:58 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 12/20] mirror: " Kevin Wolf
2023-04-25 21:09 ` Eric Blake
2023-05-01 18:59 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 13/20] block: Mark bdrv_co_get_allocated_file_size() and callers GRAPH_RDLOCK Kevin Wolf
2023-04-25 21:10 ` Eric Blake
2023-05-01 19:03 ` Stefan Hajnoczi
2023-05-04 10:52 ` Kevin Wolf
2023-04-25 17:31 ` [PATCH 14/20] block: Mark bdrv_co_get_info() " Kevin Wolf
2023-04-25 21:12 ` Eric Blake
2023-05-01 19:04 ` Stefan Hajnoczi
2023-04-25 17:31 ` Kevin Wolf [this message]
2023-04-25 21:14 ` [PATCH 15/20] block: Mark bdrv_co_debug_event() GRAPH_RDLOCK Eric Blake
2023-05-04 11:12 ` Kevin Wolf
2023-05-01 19:05 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 16/20] block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK Kevin Wolf
2023-04-25 21:20 ` Eric Blake
2023-05-01 19:07 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 17/20] block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK Kevin Wolf
2023-04-25 21:20 ` Eric Blake
2023-05-01 19:08 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 18/20] block: Mark bdrv_query_block_graph_info() " Kevin Wolf
2023-04-25 21:21 ` Eric Blake
2023-05-01 19:08 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 19/20] block: Mark bdrv_recurse_can_replace() " Kevin Wolf
2023-04-25 21:22 ` Eric Blake
2023-05-01 19:10 ` Stefan Hajnoczi
2023-04-25 17:31 ` [PATCH 20/20] block: Mark bdrv_refresh_limits() " Kevin Wolf
2023-04-25 21:23 ` Eric Blake
2023-05-01 19:10 ` Stefan Hajnoczi
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=20230425173158.574203-16-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=eesposit@redhat.com \
--cc=pbonzini@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).