[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/29] block/qed: add missing graph rdlock in qed_need_check_timer
From: |
Kevin Wolf |
Subject: |
[PULL 06/29] block/qed: add missing graph rdlock in qed_need_check_timer_entry |
Date: |
Thu, 23 Feb 2023 19:51:23 +0100 |
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
This function is called in two different places:
- timer callback, which does not take the graph rdlock.
- bdrv_qed_drain_begin(), which is .bdrv_drain_begin()
callback documented as function that does not take the lock.
Since it calls recursive functions that traverse the
graph, we need to protect them with the graph rdlock.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230203152202.49054-7-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qed.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/qed.c b/block/qed.c
index 175a46c67b..7690d0215d 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -282,11 +282,12 @@ static void coroutine_fn
qed_unplug_allocating_write_reqs(BDRVQEDState *s)
qemu_co_mutex_unlock(&s->table_lock);
}
-static void coroutine_fn qed_need_check_timer(BDRVQEDState *s)
+static void coroutine_fn GRAPH_RDLOCK qed_need_check_timer(BDRVQEDState *s)
{
int ret;
trace_qed_need_check_timer_cb(s);
+ assert_bdrv_graph_readable();
if (!qed_plug_allocating_write_reqs(s)) {
return;
@@ -312,6 +313,7 @@ static void coroutine_fn qed_need_check_timer(BDRVQEDState
*s)
static void coroutine_fn qed_need_check_timer_entry(void *opaque)
{
BDRVQEDState *s = opaque;
+ GRAPH_RDLOCK_GUARD();
qed_need_check_timer(opaque);
bdrv_dec_in_flight(s->bs);
--
2.39.2
- [PULL 00/29] Block layer patches, Kevin Wolf, 2023/02/23
- [PULL 02/29] mirror: Fix access of uninitialised fields during start, Kevin Wolf, 2023/02/23
- [PULL 01/29] block: Make bdrv_can_set_read_only() static, Kevin Wolf, 2023/02/23
- [PULL 04/29] block: Mark bdrv_co_block_status() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 05/29] block: Mark bdrv_co_ioctl() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 03/29] block: Mark bdrv_co_truncate() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 06/29] block/qed: add missing graph rdlock in qed_need_check_timer_entry,
Kevin Wolf <=
- [PULL 09/29] block: Mark bdrv_co_pwrite_zeroes() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 10/29] block: Mark read/write in block/io.c GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 11/29] block: Mark public read/write functions GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 13/29] block: Mark bdrv_co_do_pwrite_zeroes() GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 07/29] block: Mark bdrv_co_flush() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 08/29] block: Mark bdrv_co_pdiscard() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 12/29] block: Mark bdrv_co_pwrite_sync() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 15/29] block: Mark preadv_snapshot/snapshot_block_status GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 18/29] block: Mark bdrv_co_is_inserted() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 19/29] block: Mark bdrv_co_eject/lock_medium() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23