]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2.c
block/qcow2: Move bitmap reopen into bdrv_reopen_commit_post
authorPeter Krempa <pkrempa@redhat.com>
Fri, 28 Feb 2020 12:44:47 +0000 (13:44 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 6 Mar 2020 16:15:37 +0000 (17:15 +0100)
commit65eb7c85a3e62529e2bad782e94d5a7b11dd5a92
treec6d483acf62215b86d99c9c15dcfec6eb376f59d
parent17e1e2be5f9e84e0298e28e70675655b43e225ea
block/qcow2: Move bitmap reopen into bdrv_reopen_commit_post

The bitmap code requires writing the 'file' child when the qcow2 driver
is reopened in read-write mode.

If the 'file' child is being reopened due to a permissions change, the
modification is commited yet when qcow2_reopen_commit is called. This
means that any attempt to write the 'file' child will end with EBADFD
as the original fd was already closed.

Moving bitmap reopening to the new callback which is called after
permission modifications are commited fixes this as the file descriptor
will be replaced with the correct one.

The above problem manifests itself when reopening 'qcow2' format layer
which uses a 'file-posix' file child which was opened with the
'auto-read-only' property set.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Message-Id: <db118dbafe1955afbc0a18d3dd220931074ce349.1582893284.git.pkrempa@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c