open_failed:
bs->drv = NULL;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
if (bs->file != NULL) {
bdrv_unref_child(bs, bs->file);
assert(!bs->file);
bdrv_ref(drain_bs);
bdrv_drained_begin(drain_bs);
- bdrv_graph_wrlock(backing_hd);
+ bdrv_graph_wrlock();
ret = bdrv_set_backing_hd_drained(bs, backing_hd, errp);
bdrv_graph_wrunlock();
bdrv_drained_end(drain_bs);
return NULL;
}
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
ctx = bdrv_get_aio_context(bs);
aio_context_acquire(ctx);
child = bdrv_attach_child(parent, bs, bdref_key, child_class, child_role,
aio_context_release(ctx);
}
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
tran_commit(tran);
bdrv_graph_wrunlock();
goto cleanup;
abort:
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
tran_abort(tran);
bdrv_graph_wrunlock();
}
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(new_child_bs);
+ bdrv_graph_wrlock();
ret = bdrv_set_file_or_backing_noperm(bs, new_child_bs, is_backing,
tran, errp);
bs->drv = NULL;
}
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
bdrv_unref_child(bs, child);
}
bdrv_graph_rdunlock_main_loop();
bdrv_drained_begin(child_bs);
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
ret = bdrv_replace_node_common(bs, child_bs, true, true, errp);
bdrv_graph_wrunlock();
bdrv_drained_end(child_bs);
aio_context_acquire(old_context);
new_context = NULL;
- bdrv_graph_wrlock(bs_top);
+ bdrv_graph_wrlock();
child = bdrv_attach_child_noperm(bs_new, bs_top, "backing",
&child_of_bds, bdrv_backing_role(bs_new),
bdrv_ref(old_bs);
bdrv_drained_begin(old_bs);
bdrv_drained_begin(new_bs);
- bdrv_graph_wrlock(new_bs);
+ bdrv_graph_wrlock();
bdrv_replace_child_tran(child, new_bs, tran);
bdrv_ref(bs);
bdrv_drained_begin(bs);
bdrv_drained_begin(new_node_bs);
- bdrv_graph_wrlock(new_node_bs);
+ bdrv_graph_wrlock();
ret = bdrv_replace_node(bs, new_node_bs, errp);
bdrv_graph_wrunlock();
bdrv_drained_end(new_node_bs);
bdrv_ref(top);
bdrv_drained_begin(base);
- bdrv_graph_wrlock(base);
+ bdrv_graph_wrlock();
if (!top->drv || !base->drv) {
goto exit_wrlock;
}
}
+static void bdrv_schedule_unref_bh(void *opaque)
+{
+ BlockDriverState *bs = opaque;
+ AioContext *ctx = bdrv_get_aio_context(bs);
+
+ aio_context_acquire(ctx);
+ bdrv_unref(bs);
+ aio_context_release(ctx);
+}
+
/*
* Release a BlockDriverState reference while holding the graph write lock.
*
if (!bs) {
return;
}
- aio_bh_schedule_oneshot(qemu_get_aio_context(),
- (QEMUBHFunc *) bdrv_unref, bs);
+ aio_bh_schedule_oneshot(qemu_get_aio_context(), bdrv_schedule_unref_bh, bs);
}
struct BdrvOpBlocker {