Andrey
is more than one such child. Furthermore, we really only can fall back
to bs->file and bs->backing, because bdrv_snapshot_goto() has to modify
the child link (notably, set it to NULL).
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/snapshot.c | 104 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 83 insertions(+), 21 deletions(-)
diff --git a/block/snapshot.c b/block/snapshot.c
...
+ /*
+ * Check that there are no other children that would need to be
+ * snapshotted. If there are, it is not safe to fall back to
+ * *fallback.
+ */
+ QLIST_FOREACH(child, &bs->children, next) {
+ if (child->role & (BDRV_CHILD_DATA | BDRV_CHILD_METADATA |
+ BDRV_CHILD_FILTERED) &&
+ child != *fallback)
+ {
+ return NULL;
+ }
+ }
+
+ return fallback;
+}
...
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>