block: Fix reopen flag inheritance
authorKevin Wolf <kwolf@redhat.com>
Thu, 9 Apr 2015 16:54:04 +0000 (18:54 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 12 Jun 2015 15:04:59 +0000 (17:04 +0200)
commit67251a311371c4d22e803f151f47fe817175b6c3
tree40a064d981318c605579967644878d15d5258df7
parentbddcec3745b0220d4a7eda700950812a94398668
block: Fix reopen flag inheritance

When reopening an image, the block layer already takes care to reopen
bs->file as well with recalculated inherited flags. The same must happen
for any other child (most notably missing before this patch: backing
files).

If bs->file (or any other child) didn't originally inherit from bs, e.g.
because it was created separately and then only referenced, it must not
inherit flags on reopen either, so check the inherited_from field before
propagation the reopen down.

VMDK already reopened its extents manually; this code can now be
dropped.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block.c
block/vmdk.c