[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/15] block/qed: add missing graph rdlock in qed_need_check_time
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH 01/15] block/qed: add missing graph rdlock in qed_need_check_timer_entry |
Date: |
Wed, 16 Nov 2022 09:07:16 -0500 |
This function is called in two different places:
- timer callback, which does not take the graph rdlock.
- bdrv_qed_drain_begin(), which is a .bdrv_drain_begin()
callback that will soon 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>
---
block/qed.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/qed.c b/block/qed.c
index c2691a85b1..778b23d0f6 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -282,11 +282,13 @@ static void coroutine_fn
qed_unplug_allocating_write_reqs(BDRVQEDState *s)
qemu_co_mutex_unlock(&s->table_lock);
}
+/* Called with graph rdlock taken */
static void coroutine_fn 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 +314,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.31.1
- [PATCH 00/15] Protect the block layer with a rwlock: part 3, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 01/15] block/qed: add missing graph rdlock in qed_need_check_timer_entry,
Emanuele Giuseppe Esposito <=
- [PATCH 06/15] block: convert bdrv_get_allocated_file_size in generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 02/15] block: rename refresh_total_sectors in bdrv_refresh_total_sectors, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 07/15] block: convert bdrv_get_info in generated_co_wrapper, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 03/15] block-backend: use bdrv_getlength instead of blk_getlength, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 10/15] block: convert bdrv_eject in generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 11/15] block: convert bdrv_lock_medium in generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 13/15] block: convert bdrv_io_plug in generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 04/15] block: convert bdrv_refresh_total_sectors in generated_co_wrapper, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 05/15] block: use bdrv_co_refresh_total_sectors when possible, Emanuele Giuseppe Esposito, 2022/11/16
- [PATCH 08/15] block: convert bdrv_is_inserted in generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/16