[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v12 07/19] block: Block all nodes involved in the bl
From: |
Alberto Garcia |
Subject: |
[Qemu-block] [PATCH v12 07/19] block: Block all nodes involved in the block-commit operation |
Date: |
Wed, 26 Oct 2016 13:29:21 +0300 |
After a successful block-commit operation all nodes between top and
base are removed from the backing chain, and top's overlay needs to
be updated to point to base. Because of that we should prevent other
block jobs from messing with them.
This patch blocks all operations in these nodes in commit_start().
Signed-off-by: Alberto Garcia <address@hidden>
---
block/commit.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/commit.c b/block/commit.c
index 9f67a8b..1500d7c 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -216,6 +216,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,
BlockReopenQueue *reopen_queue = NULL;
int orig_overlay_flags;
int orig_base_flags;
+ BlockDriverState *iter;
BlockDriverState *overlay_bs;
Error *local_err = NULL;
@@ -260,6 +261,19 @@ void commit_start(const char *job_id, BlockDriverState *bs,
}
+ /* Block all nodes between top and base, because they will
+ * disappear from the chain after this operation. */
+ assert(bdrv_chain_contains(top, base));
+ for (iter = top; iter != backing_bs(base); iter = backing_bs(iter)) {
+ block_job_add_bdrv(&s->common, iter);
+ }
+ /* overlay_bs must be blocked because it needs to be modified to
+ * update the backing image string, but if it's the root node then
+ * don't block it again */
+ if (bs != overlay_bs) {
+ block_job_add_bdrv(&s->common, overlay_bs);
+ }
+
s->base = blk_new();
blk_insert_bs(s->base, base);
--
2.9.3
- [Qemu-block] [PATCH v12 00/19] Support streaming to an intermediate layer, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 09/19] block: Support streaming to an intermediate layer, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 05/19] block: Use block_job_add_bdrv() in backup_start(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 01/19] block: Add bdrv_drain_all_{begin, end}(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 06/19] block: Check blockers in all nodes involved in a block-commit job, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 04/19] block: Use block_job_add_bdrv() in mirror_start_job(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 07/19] block: Block all nodes involved in the block-commit operation,
Alberto Garcia <=
- [Qemu-block] [PATCH v12 02/19] block: Pause all jobs during bdrv_reopen_multiple(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 19/19] qemu-iotests: Test the 'base-node' parameter of 'block-stream', Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 15/19] qemu-iotests: Test block-stream and block-commit in parallel, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 12/19] qemu-iotests: Test streaming to an intermediate layer, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 16/19] qemu-iotests: Add iotests.supports_quorum(), Alberto Garcia, 2016/10/26