aboutsummaryrefslogtreecommitdiff
path: root/block/replication.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-09-11 11:46:19 +0200
committerKevin Wolf <kwolf@redhat.com>2023-09-20 17:46:01 +0200
commit32a8aba37eaae54d3a0a7ae5e93e3e157525660a (patch)
treec310d966906d71c635c89425f2e1f314dfafdba9 /block/replication.c
parentede01e4635050a395eacd57b7d7fbea8ea208704 (diff)
block: Mark bdrv_unref_child() GRAPH_WRLOCK
Instead of taking the writer lock internally, require callers to already hold it when calling bdrv_unref_child(). 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> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20230911094620.45040-21-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/replication.c')
-rw-r--r--block/replication.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/replication.c b/block/replication.c
index eec9819625..dd166d2d82 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -672,10 +672,13 @@ static void replication_done(void *opaque, int ret)
if (ret == 0) {
s->stage = BLOCK_REPLICATION_DONE;
+ bdrv_graph_wrlock(NULL);
bdrv_unref_child(bs, s->secondary_disk);
s->secondary_disk = NULL;
bdrv_unref_child(bs, s->hidden_disk);
s->hidden_disk = NULL;
+ bdrv_graph_wrunlock();
+
s->error = 0;
} else {
s->stage = BLOCK_REPLICATION_FAILOVER_FAILED;