diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-09-29 16:51:49 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-10-12 16:31:33 +0200 |
commit | 0bb79c97fd8e355aca433f4331d7d45e7e72b4b6 (patch) | |
tree | f3fe385db7fe95942384ecc382ee644962b7a45d /block/replication.c | |
parent | bd131d6705b6996f2cdccee3db017af570ce91ad (diff) |
qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of
qcow2_signal_corruption() need to hold a reader lock for the graph
because it calls bdrv_get_node_name(), which accesses the parents list
of a node.
For some places, we know that they will hold the lock, but we don't have
the GRAPH_RDLOCK annotations yet. In this case, add assume_graph_lock()
with a FIXME comment. These places will be removed once everything is
properly annotated.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230929145157.45443-15-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/replication.c')
-rw-r--r-- | block/replication.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/block/replication.c b/block/replication.c index 107445d0ce..3459f50669 100644 --- a/block/replication.c +++ b/block/replication.c @@ -307,13 +307,16 @@ out: return ret; } -static void secondary_do_checkpoint(BlockDriverState *bs, Error **errp) +static void GRAPH_UNLOCKED +secondary_do_checkpoint(BlockDriverState *bs, Error **errp) { BDRVReplicationState *s = bs->opaque; BdrvChild *active_disk = bs->file; Error *local_err = NULL; int ret; + GRAPH_RDLOCK_GUARD_MAINLOOP(); + if (!s->backup_job) { error_setg(errp, "Backup job was cancelled unexpectedly"); return; @@ -531,13 +534,16 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, /* Must be true, or the bdrv_getlength() calls would have failed */ assert(active_disk->bs->drv && hidden_disk->bs->drv); + bdrv_graph_rdlock_main_loop(); if (!active_disk->bs->drv->bdrv_make_empty || !hidden_disk->bs->drv->bdrv_make_empty) { error_setg(errp, "Active disk or hidden disk doesn't support make_empty"); aio_context_release(aio_context); + bdrv_graph_rdunlock_main_loop(); return; } + bdrv_graph_rdunlock_main_loop(); /* reopen the backing file in r/w mode */ reopen_backing_file(bs, true, &local_err); |