[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 9/9] qcow2: Make image inaccessible after failed
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH v2 9/9] qcow2: Make image inaccessible after failed qcow2_invalidate_cache() |
Date: |
Wed, 13 Jan 2016 17:37:16 +0100 |
If qcow2_invalidate_cache() fails, we are in a state where qcow2_close()
has already been completed, but the image hasn't been reopened yet.
Calling into any qcow2 function for an image in this state will cause
crashes.
The real solution would be to get rid of the close/open pair and instead
do an atomic reset of the involved data structures, but this isn't
trivial, so let's just make the image inaccessible for now.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block/qcow2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index 1b9c5fc..28d1a4b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1763,6 +1763,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs,
Error **errp)
bdrv_invalidate_cache(bs->file->bs, &local_err);
if (local_err) {
error_propagate(errp, local_err);
+ bs->drv = NULL;
return;
}
@@ -1776,9 +1777,11 @@ static void qcow2_invalidate_cache(BlockDriverState *bs,
Error **errp)
error_setg(errp, "Could not reopen qcow2 layer: %s",
error_get_pretty(local_err));
error_free(local_err);
+ bs->drv = NULL;
return;
} else if (ret < 0) {
error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");
+ bs->drv = NULL;
return;
}
--
1.8.3.1
- [Qemu-block] [PATCH v2 0/9] block/qcow2: Migration handoff fixes and cleanups, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 2/9] qcow2: Write full header on image creation, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 1/9] qcow2: Write feature table only for v3 images, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 3/9] block: Assert no write requests under BDRV_O_INCOMING, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 4/9] block: Fix error path in bdrv_invalidate_cache(), Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 6/9] block: Inactivate BDS when migration completes, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 5/9] block: Rename BDRV_O_INCOMING to BDRV_O_INACTIVE, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 7/9] qcow2: Implement .bdrv_inactivate, Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 8/9] qcow2: Fix BDRV_O_INACTIVE handling in qcow2_invalidate_cache(), Kevin Wolf, 2016/01/13
- [Qemu-block] [PATCH v2 9/9] qcow2: Make image inaccessible after failed qcow2_invalidate_cache(),
Kevin Wolf <=
- Re: [Qemu-block] [PATCH v2 0/9] block/qcow2: Migration handoff fixes and cleanups, Kevin Wolf, 2016/01/19