[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/10] qcow2: Fix BDRV_O_INCOMING handling in qcow2_
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 08/10] qcow2: Fix BDRV_O_INCOMING handling in qcow2_invalidate_cache() |
Date: |
Tue, 22 Dec 2015 17:46:24 +0100 |
What qcow2_invalidate_cache() should do is closing the image with
BDRV_O_INCOMING set and reopening it with the flag cleared. In fact, it
used to do exactly the opposite: qcow2_close() relied on bs->open_flags,
which is already updated to have cleared BDRV_O_INCOMING at this point,
whereas qcow2_open() was called with s->flags, which has the flag still
set. Fix this.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 2cba276..de50b80 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1718,7 +1718,7 @@ static void qcow2_close(BlockDriverState *bs)
/* else pre-write overlap checks in cache_destroy may crash */
s->l1_table = NULL;
- if (!(bs->open_flags & BDRV_O_INCOMING)) {
+ if (!(s->flags & BDRV_O_INCOMING)) {
qcow2_inactivate(bs);
}
@@ -1769,6 +1769,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs,
Error **errp)
memset(s, 0, sizeof(BDRVQcow2State));
options = qdict_clone_shallow(bs->options);
+ flags &= ~BDRV_O_INCOMING;
ret = qcow2_open(bs, options, flags, &local_err);
QDECREF(options);
if (local_err) {
--
1.8.3.1
- Re: [Qemu-devel] [PATCH 04/10] block: Fix error path in bdrv_invalidate_cache(), (continued)
- [Qemu-devel] [PATCH 05/10] block: Inactivate BDS when migration completes, Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 07/10] qcow2: Implement .bdrv_inactivate, Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 06/10] qemu-img: Prepare for locked images, Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 08/10] qcow2: Fix BDRV_O_INCOMING handling in qcow2_invalidate_cache(),
Kevin Wolf <=
- [Qemu-devel] [PATCH 09/10] qcow2: Make image inaccessible after failed qcow2_invalidate_cache(), Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 10/10] qcow2: Add image locking, Kevin Wolf, 2015/12/22
- Re: [Qemu-devel] [PATCH 00/10] qcow2: Implement image locking, Fam Zheng, 2015/12/22