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>
This commit is contained in:
Kevin Wolf 2023-10-27 17:53:14 +02:00
parent 03b9eaca54
commit f3bbc53dc5
8 changed files with 45 additions and 15 deletions

View file

@ -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: