[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/23] block/qed: add missing graph rdlock in qed_need_check_time
From: |
Kevin Wolf |
Subject: |
[PATCH 06/23] block/qed: add missing graph rdlock in qed_need_check_timer_entry |
Date: |
Fri, 3 Feb 2023 16:21:45 +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>
---
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.38.1
- [PATCH 00/23] block: Lock the graph, part 2 (BlockDriver callbacks), Kevin Wolf, 2023/02/03
- [PATCH 01/23] block: Make bdrv_can_set_read_only() static, Kevin Wolf, 2023/02/03
- [PATCH 03/23] block: Mark bdrv_co_truncate() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 04/23] block: Mark bdrv_co_block_status() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 06/23] block/qed: add missing graph rdlock in qed_need_check_timer_entry,
Kevin Wolf <=
- [PATCH 02/23] mirror: Fix access of uninitialised fields during start, Kevin Wolf, 2023/02/03
- [PATCH 05/23] block: Mark bdrv_co_ioctl() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 08/23] block: Mark bdrv_co_pdiscard() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 09/23] block: Mark bdrv_co_pwrite_zeroes() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 10/23] block: Mark read/write in block/io.c GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 12/23] block: Mark bdrv_co_pwrite_sync() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 07/23] block: Mark bdrv_co_flush() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 11/23] block: Mark public read/write functions GRAPH_RDLOCK, Kevin Wolf, 2023/02/03
- [PATCH 13/23] block: Mark bdrv_co_do_pwrite_zeroes() GRAPH_RDLOCK, Kevin Wolf, 2023/02/03