OSDN Git Service

block/snapshot: Fix fallback
authorMax Reitz <mreitz@redhat.com>
Wed, 12 Jun 2019 16:21:07 +0000 (18:21 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 7 Sep 2020 10:31:31 +0000 (12:31 +0200)
commitc8af87573f90e6b2ce828177664ea552efe2b249
tree645661d8364863283eb211cad408fe05362e1d9e
parentc4db2e25df0e4a91bd8a8044756fe3c712b11768
block/snapshot: Fix fallback

If the top node's driver does not provide snapshot functionality and we
want to fall back to a node down the chain, we need to snapshot all
non-COW children.  For simplicity's sake, just do not fall back if there
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>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
block/snapshot.c