[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/31] Revert "block: another bdrv_append fix"
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 15/31] Revert "block: another bdrv_append fix" |
Date: |
Wed, 30 Apr 2014 20:23:47 +0200 |
This reverts commit 3a389e7926750cba5c83f662b1941888b2bebc04. The commit
was wrong and what it tried to fix just works today without any change.
What the commit tried to fix:
When creating live snapshots, the new image file is opened with
BDRV_O_NO_BACKING because the whole backing chain is already opened.
It is then appended to the chain using bdrv_append(). The result of
this was that the image had a backing file, but BDRV_O_NO_BACKING
was still set. This is obviously inconsistent.
There used to be some places in qemu that closed and image and then
opened it again, with its old flags (a bdrv_open()/close() sequence
involves reopening the whole backing file chain, too). In this case
the BDRV_O_NO_BACKING flag meant that the backing chain wasn't
reopened and only the top layer was left.
(Most, but not all of these places are replaced by bdrv_reopen()
today, which doesn't touch the backing files at all.)
Other places that looked at bs->open_flags weren't interested in
BDRV_O_NO_BACKING, so no breakage there.
What it actually did:
The commit moved the BDRV_O_NO_BACKING away to the backing file.
Because the bdrv_open()/close() sequences only looked at the flags
of the top level BlockDriverState and used it for the whole chain,
the flag didn't hurt there any more. Obviously, it is still
inconsistent because the backing file may have another backing file,
but without practical impact.
At the same time, it swapped all other flags. This is practically
irrelevant as long as live snapshots only allow opening the new
layer with the same flags as the old top layer. It still doesn't
make any sense, and it is a time bomb that explodes as soon as the
flags can differ.
bdrv_append_temp_snapshot() is such a case: It adds the new flag
BDRV_O_TEMPORARY for the temporary snapshot. The swapping of commit
3a389e79 results in the following nonsensical configuration:
bs->open_flags: BDRV_O_TEMPORARY cleared
bs->file->open_flags: BDRV_O_TEMPORARY set
bs->backing_hd->open_flags: BDRV_O_TEMPORARY set
bs->backing_hd->file->open_flags: BDRV_O_TEMPORARY cleared
We're still lucky because the format layer ignores the flag and the
protocol layer happens to get the right value, but sooner or later
this is bound to go wrong...
What the right fix would have been:
Simply clear the BDRV_O_NO_BACKING flag when the BlockDriverState is
appended to an existing backing file chain, because now it does have
a backing file.
Commit 4ddc07ca already implemented this silently in bdrv_append(),
so we don't have to come up with a new fix.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/block.c b/block.c
index c094075..9f6f07e 100644
--- a/block.c
+++ b/block.c
@@ -1864,7 +1864,6 @@ static void bdrv_move_feature_fields(BlockDriverState
*bs_dest,
BlockDriverState *bs_src)
{
/* move some fields that need to stay attached to the device */
- bs_dest->open_flags = bs_src->open_flags;
/* dev info */
bs_dest->dev_ops = bs_src->dev_ops;
--
1.8.3.1
- [Qemu-devel] [PULL 07/31] block: qemu-iotests - fix image cleanup when using spaced pathnames, (continued)
- [Qemu-devel] [PULL 07/31] block: qemu-iotests - fix image cleanup when using spaced pathnames, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 06/31] mirror: Check for bdrv_get_info result, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 08/31] block: qemu-iotests: make test 019 and 086 work with spaced pathnames, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 05/31] mirror: Fix resource leak when bdrv_getlength fails, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 10/31] iotests: Discarding compressed clusters on qcow2, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 09/31] qcow2: Fix discard, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 11/31] block: Create bdrv_inherited_flags(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 12/31] block: Create bdrv_backing_flags(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 13/31] block: Remove BDRV_O_COPY_ON_READ for bs->file, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 14/31] block: Unlink temporary files in raw-posix/win32, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 15/31] Revert "block: another bdrv_append fix",
Kevin Wolf <=
- [Qemu-devel] [PULL 16/31] block: Fix open_flags in bdrv_reopen(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 17/31] block: Use error_abort in bdrv_image_info_specific_dump(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 19/31] block: Use correct width in format strings, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 18/31] qcow2: Avoid overflow in alloc_clusters_noref(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 20/31] qcow2: Catch bdrv_getlength() error, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 23/31] block/vdi: Error out immediately in vdi_create(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 22/31] block/bochs: Fix error handling for seek_to_sector(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 21/31] qcow2: Check min_size in qcow2_grow_l1_table(), Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 24/31] curl: Fix long line, Kevin Wolf, 2014/04/30
- [Qemu-devel] [PULL 26/31] curl: Fix return from curl_read_cb with invalid state, Kevin Wolf, 2014/04/30