mirror of https://github.com/xemu-project/xemu.git
block/qed: add missing graph rdlock in qed_need_check_timer_entry
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>
This commit is contained in:
parent
26c518ab1e
commit
c16b8bd4e5
|
@ -282,11 +282,12 @@ static void coroutine_fn qed_unplug_allocating_write_reqs(BDRVQEDState *s)
|
||||||
qemu_co_mutex_unlock(&s->table_lock);
|
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;
|
int ret;
|
||||||
|
|
||||||
trace_qed_need_check_timer_cb(s);
|
trace_qed_need_check_timer_cb(s);
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
|
|
||||||
if (!qed_plug_allocating_write_reqs(s)) {
|
if (!qed_plug_allocating_write_reqs(s)) {
|
||||||
return;
|
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)
|
static void coroutine_fn qed_need_check_timer_entry(void *opaque)
|
||||||
{
|
{
|
||||||
BDRVQEDState *s = opaque;
|
BDRVQEDState *s = opaque;
|
||||||
|
GRAPH_RDLOCK_GUARD();
|
||||||
|
|
||||||
qed_need_check_timer(opaque);
|
qed_need_check_timer(opaque);
|
||||||
bdrv_dec_in_flight(s->bs);
|
bdrv_dec_in_flight(s->bs);
|
||||||
|
|
Loading…
Reference in New Issue