[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/9] stream: Fix AioContext locking during bdrv_graph_wrlock()
From: |
Kevin Wolf |
Subject: |
[PULL 4/9] stream: Fix AioContext locking during bdrv_graph_wrlock() |
Date: |
Tue, 21 Nov 2023 12:52:57 +0100 |
In stream_prepare(), we need to temporarily drop the AioContext lock
that job_prepare_locked() took for us while calling the graph write lock
functions which can poll.
All block nodes related to this block job are in the same AioContext, so
we can pass any of them to bdrv_graph_wrlock()/ bdrv_graph_wrunlock().
Unfortunately, the one that we picked is base, which can be NULL - and
in this case the AioContext lock is not released and deadlocks can
occur.
Fix this by passing s->target_bs, which is never NULL.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231115172012.112727-4-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/stream.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/stream.c b/block/stream.c
index e3aa696289..01fe7c0f16 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -99,9 +99,9 @@ static int stream_prepare(Job *job)
}
}
- bdrv_graph_wrlock(base);
+ bdrv_graph_wrlock(s->target_bs);
bdrv_set_backing_hd_drained(unfiltered_bs, base, &local_err);
- bdrv_graph_wrunlock(base);
+ bdrv_graph_wrunlock(s->target_bs);
/*
* This call will do I/O, so the graph can change again from here on.
--
2.42.0
- [PULL 0/9] Block layer fixes for 8.2.0-rc1, Kevin Wolf, 2023/11/21
- [PULL 2/9] block: Fix bdrv_graph_wrlock() call in blk_remove_bs(), Kevin Wolf, 2023/11/21
- [PULL 1/9] hw/ide/ahci: fix legacy software reset, Kevin Wolf, 2023/11/21
- [PULL 3/9] block: Fix deadlocks in bdrv_graph_wrunlock(), Kevin Wolf, 2023/11/21
- [PULL 4/9] stream: Fix AioContext locking during bdrv_graph_wrlock(),
Kevin Wolf <=
- [PULL 6/9] ide/ioport: move ide_portio_list[] and ide_portio_list2[] definitions to IDE core, Kevin Wolf, 2023/11/21
- [PULL 8/9] ide/via: don't attempt to set default BAR addresses, Kevin Wolf, 2023/11/21
- [PULL 7/9] ide/pci: introduce pci_ide_update_mode() function, Kevin Wolf, 2023/11/21
- [PULL 5/9] iotests: Test two stream jobs in a single iothread, Kevin Wolf, 2023/11/21
- [PULL 9/9] hw/ide/via: implement legacy/native mode switching, Kevin Wolf, 2023/11/21
- Re: [PULL 0/9] Block layer fixes for 8.2.0-rc1, Stefan Hajnoczi, 2023/11/21