aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-09-29 16:51:56 +0200
committerKevin Wolf <kwolf@redhat.com>2023-10-12 16:31:33 +0200
commit680e0cc40c5830ebcbfa0bce99bf932e1a4cf6c6 (patch)
tree25d4599f69d96706708243a273e1a4f37124075e /tests/unit
parentb59b466071391cb76b39584e1558be2d0797c054 (diff)
block: Protect bs->children with graph_lock
Almost all functions that access the child links already take the graph lock now. Add locking to the remaining users and finally annotate the struct field itself as protected by the graph lock. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-22-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-bdrv-drain.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c
index d734829778..f67e9df01c 100644
--- a/tests/unit/test-bdrv-drain.c
+++ b/tests/unit/test-bdrv-drain.c
@@ -1034,9 +1034,13 @@ static void coroutine_fn test_co_delete_by_drain(void *opaque)
blk_co_unref(blk);
} else {
BdrvChild *c, *next_c;
+ bdrv_graph_co_rdlock();
QLIST_FOREACH_SAFE(c, &bs->children, next, next_c) {
+ bdrv_graph_co_rdunlock();
bdrv_co_unref_child(bs, c);
+ bdrv_graph_co_rdlock();
}
+ bdrv_graph_co_rdunlock();
}
dbdd->done = true;