[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 35/39] qcow2: fix autoclear image header update
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 35/39] qcow2: fix autoclear image header update |
Date: |
Fri, 15 Jun 2012 15:33:35 +0200 |
From: Stefan Hajnoczi <address@hidden>
The autoclear feature bits can be used for qcow2 file format features
that are safe to "drop" by old programs that do not understand the
feature. Upon opening the image file unknown autoclear feature bits are
cleared and the image file header is rewritten, but this was happening
too early in the code when critical header fields were not yet loaded.
Process autoclear feature bits after all necessary header information
has been loaded.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 57fd43d..2c1cd0a 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -297,14 +297,6 @@ static int qcow2_open(BlockDriverState *bs, int flags)
goto fail;
}
- if (!bs->read_only && s->autoclear_features != 0) {
- s->autoclear_features = 0;
- ret = qcow2_update_header(bs);
- if (ret < 0) {
- goto fail;
- }
- }
-
/* Check support for various header values */
if (header.refcount_order != 4) {
report_unsupported(bs, "%d bit reference counts",
@@ -408,6 +400,15 @@ static int qcow2_open(BlockDriverState *bs, int flags)
goto fail;
}
+ /* Clear unknown autoclear feature bits */
+ if (!bs->read_only && s->autoclear_features != 0) {
+ s->autoclear_features = 0;
+ ret = qcow2_update_header(bs);
+ if (ret < 0) {
+ goto fail;
+ }
+ }
+
/* Initialise locks */
qemu_co_mutex_init(&s->lock);
--
1.7.6.5
- [Qemu-devel] [PATCH 22/39] block: copy enable_write_cache in bdrv_append, (continued)
- [Qemu-devel] [PATCH 22/39] block: copy enable_write_cache in bdrv_append, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 23/39] block: add bdrv_set_enable_write_cache, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 19/39] qemu-iotests: start vms in qtest mode, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 25/39] ide: support enable/disable write cache, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 20/39] block: flush in writethrough mode after writes, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 36/39] fdc: fix implied seek while there is no media in drive, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 38/39] qemu-iotests: add qcow2.py set-feature-bit command, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 39/39] qemu-iotests: add 036 autoclear feature bit test, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 30/39] qemu-iotests: COW with many AIO requests on the same cluster, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 31/39] qemu-img: document qed format on qemu-img man page, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 35/39] qcow2: fix autoclear image header update,
Kevin Wolf <=
- [Qemu-devel] [PATCH 37/39] fdc-test: introduced qtest read_without_media, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 28/39] qcow2: Fix avail_sectors in cluster allocation code, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 24/39] block: always open drivers in writeback mode, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 33/39] xen: Don't change -drive if=xen device name during machine init, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 29/39] qemu-iotests: Some backing file COW tests, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 26/39] qcow2: always operate caches in writeback mode, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 32/39] block: Replace bdrv_get_format() by bdrv_get_format_name(), Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 34/39] xen: Don't peek behind the BlockDriverState abstraction, Kevin Wolf, 2012/06/15
- [Qemu-devel] [PATCH 27/39] qcow2: Simplify calculation for COW area at the end, Kevin Wolf, 2012/06/15
- Re: [Qemu-devel] [PULL 00/39] Block patches, Anthony Liguori, 2012/06/20