From 7cc734a9ea1c57afe3b3fdeaba33b6a7da73bca2 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Wed, 12 Jun 2019 18:34:46 +0200 Subject: blockdev: Use CAF in external_snapshot_prepare() This allows us to differentiate between filters and nodes with COW backing files: Filters cannot be used as overlays at all (for this function). Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- blockdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index 862aa1b9aa..57ee41b73e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1562,7 +1562,12 @@ static void external_snapshot_prepare(BlkActionState *common, goto out; } - if (state->new_bs->backing != NULL) { + if (state->new_bs->drv->is_filter) { + error_setg(errp, "Filters cannot be used as overlays"); + goto out; + } + + if (bdrv_cow_child(state->new_bs)) { error_setg(errp, "The overlay already has a backing image"); goto out; } -- cgit v1.2.3