Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- Could the bs associated to the device change because of polling when draining? If yes, does that mean we need to drain all in the beginning and not temporarily unlock?
blockdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index f2b4fdf1b3..4a672f9bac 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1368,7 +1368,7 @@ static void external_snapshot_action(TransactionAction *action, uint64_t perm, shared; /* TODO We'll eventually have to take a writer lock in this function */ - GRAPH_RDLOCK_GUARD_MAINLOOP(); + bdrv_graph_rdlock_main_loop(); tran_add(tran, &external_snapshot_drv, state); @@ -1401,11 +1401,14 @@ static void external_snapshot_action(TransactionAction *action, state->old_bs = bdrv_lookup_bs(device, node_name, errp); if (!state->old_bs) { + bdrv_graph_rdunlock_main_loop(); return; } + bdrv_graph_rdunlock_main_loop(); /* Paired with .clean() */ bdrv_drained_begin(state->old_bs); + GRAPH_RDLOCK_GUARD_MAINLOOP(); if (!bdrv_is_inserted(state->old_bs)) { error_setg(errp, "Device '%s' has no medium", -- 2.39.5