On 05/10/21 16:32, Emanuele Giuseppe Esposito wrote:
backup-top functions always run under BQL lock.
Signed-off-by: Emanuele Giuseppe Esposito <eespo...@redhat.com>
---
block/backup-top.c | 2 ++
block/backup-top.h | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/block/backup-top.c b/block/backup-top.c
index 425e3778be..8b58a909f7 100644
--- a/block/backup-top.c
+++ b/block/backup-top.c
@@ -182,6 +182,7 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState
*source,
bool appended = false;
assert(source->total_sectors == target->total_sectors);
+ g_assert(qemu_in_main_thread());
top = bdrv_new_open_driver(&bdrv_backup_top_filter, filter_node_name,
BDRV_O_RDWR, errp);
@@ -244,6 +245,7 @@ fail:
void bdrv_backup_top_drop(BlockDriverState *bs)
{
BDRVBackupTopState *s = bs->opaque;
+ g_assert(qemu_in_main_thread());
bdrv_drop_filter(bs, &error_abort);
diff --git a/block/backup-top.h b/block/backup-top.h
index b28b0031c4..8cb6f62869 100644
--- a/block/backup-top.h
+++ b/block/backup-top.h
@@ -29,6 +29,17 @@
#include "block/block_int.h"
#include "block/block-copy.h"
+/*
+ * Graph API. These functions run under the BQL lock.
+ *
+ * If a function modifies the graph, it uses drain and/or
+ * aio_context_acquire/release to be sure it has unique access.
+ *
+ * All functions in this header must use this assertion:
+ * g_assert(qemu_in_main_thread());
+ * to be sure they belong here.
+ */
+
BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
BlockDriverState *target,
const char *filter_node_name,
This is now bdrv_cbw_append, but anyway:
Reviewed-by: Paolo Bonzini <pbonz...@redhat.com>