[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/21] block: Take graph rdlock in bdrv_change_aio_context()
From: |
Kevin Wolf |
Subject: |
[PATCH 18/21] block: Take graph rdlock in bdrv_change_aio_context() |
Date: |
Thu, 17 Aug 2023 14:50:17 +0200 |
The function reads the parents list, so it needs to hold the graph lock.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block.c b/block.c
index a82389f742..c0a8460434 100644
--- a/block.c
+++ b/block.c
@@ -7669,17 +7669,21 @@ static bool bdrv_change_aio_context(BlockDriverState
*bs, AioContext *ctx,
return true;
}
+ bdrv_graph_rdlock_main_loop();
QLIST_FOREACH(c, &bs->parents, next_parent) {
if (!bdrv_parent_change_aio_context(c, ctx, visited, tran, errp)) {
+ bdrv_graph_rdunlock_main_loop();
return false;
}
}
QLIST_FOREACH(c, &bs->children, next) {
if (!bdrv_child_change_aio_context(c, ctx, visited, tran, errp)) {
+ bdrv_graph_rdunlock_main_loop();
return false;
}
}
+ bdrv_graph_rdunlock_main_loop();
state = g_new(BdrvStateSetAioContext, 1);
*state = (BdrvStateSetAioContext) {
--
2.41.0
- Re: [PATCH 04/21] block: Take AioContext lock for bdrv_append() more consistently, (continued)
- [PATCH 17/21] block: Take graph rdlock in bdrv_drop_intermediate(), Kevin Wolf, 2023/08/17
- [PATCH 14/21] block: Mark bdrv_get_cumulative_perm() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/08/17
- [PATCH 10/21] block: Mark bdrv_attach_child_common() GRAPH_WRLOCK, Kevin Wolf, 2023/08/17
- [PATCH 18/21] block: Take graph rdlock in bdrv_change_aio_context(),
Kevin Wolf <=
- [PATCH 21/21] block: Mark bdrv_add/del_child() and caller GRAPH_WRLOCK, Kevin Wolf, 2023/08/17
- [PATCH 20/21] block: Mark bdrv_unref_child() GRAPH_WRLOCK, Kevin Wolf, 2023/08/17
- [PATCH 12/21] block: Mark bdrv_attach_child() GRAPH_WRLOCK, Kevin Wolf, 2023/08/17