aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-10-27 17:53:14 +0200
committerKevin Wolf <kwolf@redhat.com>2023-11-07 19:14:19 +0100
commitf3bbc53dc56c5d410f76442da6ad15ec8f9439fc (patch)
treecd6a05dfd503b5922695d95c1843e5d71d428401 /tests
parent03b9eaca540322dd6dd4810aa57f3196ce971542 (diff)
downloadqemu-f3bbc53dc56c5d410f76442da6ad15ec8f9439fc.zip
qemu-f3bbc53dc56c5d410f76442da6ad15ec8f9439fc.tar.gz
qemu-f3bbc53dc56c5d410f76442da6ad15ec8f9439fc.tar.bz2
block: Mark block_job_add_bdrv() GRAPH_WRLOCK
Instead of taking the writer lock internally, require callers to already hold it when calling block_job_add_bdrv(). These callers will typically already hold the graph lock once the locking work is completed, which means that they can't call functions that take it internally. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20231027155333.420094-6-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test-bdrv-drain.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c
index f67e9df..40d17b4 100644
--- a/tests/unit/test-bdrv-drain.c
+++ b/tests/unit/test-bdrv-drain.c
@@ -794,7 +794,10 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
0, 0, NULL, NULL, &error_abort);
tjob->bs = src;
job = &tjob->common;
+
+ bdrv_graph_wrlock(target);
block_job_add_bdrv(job, "target", target, 0, BLK_PERM_ALL, &error_abort);
+ bdrv_graph_wrunlock();
switch (result) {
case TEST_JOB_SUCCESS: