@@ -45,6 +45,7 @@ static int coroutine_fn blockdev_amend_run(Job *job, Error **errp)
{
BlockdevAmendJob *s = container_of(job, BlockdevAmendJob, common);
int ret;
+ GRAPH_RDLOCK_GUARD();
job_progress_set_remaining(&s->common, 1);
ret = s->bs->drv->bdrv_co_amend(s->bs, s->opts, s->force, errp);
@@ -43,6 +43,7 @@ static int coroutine_fn blockdev_create_run(Job *job, Error **errp)
int ret;
GLOBAL_STATE_CODE();
+ GRAPH_RDLOCK_GUARD();
job_progress_set_remaining(&s->common, 1);
ret = s->drv->bdrv_co_create(s->opts, errp);
@@ -251,6 +251,7 @@ struct BlockDriver {
Error **errp);
void (*bdrv_close)(BlockDriverState *bs);
+ /* Called with graph rdlock taken */
int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts,
Error **errp);
/* Called with graph rdlock taken */
@@ -471,6 +472,7 @@ struct BlockDriver {
int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename);
+ /* Called with graph rdlock taken. */
int coroutine_fn (*bdrv_co_amend)(BlockDriverState *bs,
BlockdevAmendOptions *opts,
bool force,
Both functions are only called by Job->run() callbacks, therefore they must take the lock in the *_run() implementation. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> --- block/amend.c | 1 + block/create.c | 1 + include/block/block_int-common.h | 2 ++ 3 files changed, 4 insertions(+)