block: Mark bdrv_co_refresh_total_sectors() and callers GRAPH_RDLOCK

This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_co_refresh_total_sectors() need to hold a reader lock for the
graph.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230203152202.49054-24-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2023-02-03 16:22:02 +01:00
parent 167f748d8c
commit 8ab8140a04
18 changed files with 45 additions and 23 deletions

View file

@ -141,9 +141,11 @@ static int coroutine_fn stream_run(Job *job, Error **errp)
return 0;
}
len = bdrv_getlength(s->target_bs);
if (len < 0) {
return len;
WITH_GRAPH_RDLOCK_GUARD() {
len = bdrv_co_getlength(s->target_bs);
if (len < 0) {
return len;
}
}
job_progress_set_remaining(&s->common.job, len);