|
@@ -35,8 +35,8 @@ typedef struct BDRVStateCOR {
|
|
} BDRVStateCOR;
|
|
} BDRVStateCOR;
|
|
|
|
|
|
|
|
|
|
-static int cor_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
|
- Error **errp)
|
|
|
|
|
|
+static int GRAPH_UNLOCKED
|
|
|
|
+cor_open(BlockDriverState *bs, QDict *options, int flags, Error **errp)
|
|
{
|
|
{
|
|
BlockDriverState *bottom_bs = NULL;
|
|
BlockDriverState *bottom_bs = NULL;
|
|
BDRVStateCOR *state = bs->opaque;
|
|
BDRVStateCOR *state = bs->opaque;
|
|
@@ -44,6 +44,8 @@ static int cor_open(BlockDriverState *bs, QDict *options, int flags,
|
|
const char *bottom_node = qdict_get_try_str(options, "bottom");
|
|
const char *bottom_node = qdict_get_try_str(options, "bottom");
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
|
|
+ GLOBAL_STATE_CODE();
|
|
|
|
+
|
|
ret = bdrv_open_file_child(NULL, options, "file", bs, errp);
|
|
ret = bdrv_open_file_child(NULL, options, "file", bs, errp);
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
return ret;
|
|
return ret;
|
|
@@ -59,6 +61,8 @@ static int cor_open(BlockDriverState *bs, QDict *options, int flags,
|
|
bs->file->bs->supported_zero_flags);
|
|
bs->file->bs->supported_zero_flags);
|
|
|
|
|
|
if (bottom_node) {
|
|
if (bottom_node) {
|
|
|
|
+ GRAPH_RDLOCK_GUARD_MAINLOOP();
|
|
|
|
+
|
|
bottom_bs = bdrv_find_node(bottom_node);
|
|
bottom_bs = bdrv_find_node(bottom_node);
|
|
if (!bottom_bs) {
|
|
if (!bottom_bs) {
|
|
error_setg(errp, "Bottom node '%s' not found", bottom_node);
|
|
error_setg(errp, "Bottom node '%s' not found", bottom_node);
|
|
@@ -227,13 +231,17 @@ cor_co_lock_medium(BlockDriverState *bs, bool locked)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static void cor_close(BlockDriverState *bs)
|
|
|
|
|
|
+static void GRAPH_UNLOCKED cor_close(BlockDriverState *bs)
|
|
{
|
|
{
|
|
BDRVStateCOR *s = bs->opaque;
|
|
BDRVStateCOR *s = bs->opaque;
|
|
|
|
|
|
|
|
+ GLOBAL_STATE_CODE();
|
|
|
|
+
|
|
if (s->chain_frozen) {
|
|
if (s->chain_frozen) {
|
|
|
|
+ bdrv_graph_rdlock_main_loop();
|
|
s->chain_frozen = false;
|
|
s->chain_frozen = false;
|
|
bdrv_unfreeze_backing_chain(bs, s->bottom_bs);
|
|
bdrv_unfreeze_backing_chain(bs, s->bottom_bs);
|
|
|
|
+ bdrv_graph_rdunlock_main_loop();
|
|
}
|
|
}
|
|
|
|
|
|
bdrv_unref(s->bottom_bs);
|
|
bdrv_unref(s->bottom_bs);
|
|
@@ -263,12 +271,15 @@ static BlockDriver bdrv_copy_on_read = {
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
-void bdrv_cor_filter_drop(BlockDriverState *cor_filter_bs)
|
|
|
|
|
|
+void no_coroutine_fn bdrv_cor_filter_drop(BlockDriverState *cor_filter_bs)
|
|
{
|
|
{
|
|
BDRVStateCOR *s = cor_filter_bs->opaque;
|
|
BDRVStateCOR *s = cor_filter_bs->opaque;
|
|
|
|
|
|
|
|
+ GLOBAL_STATE_CODE();
|
|
|
|
+
|
|
/* unfreeze, as otherwise bdrv_replace_node() will fail */
|
|
/* unfreeze, as otherwise bdrv_replace_node() will fail */
|
|
if (s->chain_frozen) {
|
|
if (s->chain_frozen) {
|
|
|
|
+ GRAPH_RDLOCK_GUARD_MAINLOOP();
|
|
s->chain_frozen = false;
|
|
s->chain_frozen = false;
|
|
bdrv_unfreeze_backing_chain(cor_filter_bs, s->bottom_bs);
|
|
bdrv_unfreeze_backing_chain(cor_filter_bs, s->bottom_bs);
|
|
}
|
|
}
|