[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 12/29] block: Block all nodes involved in the block-c
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 12/29] block: Block all nodes involved in the block-commit operation |
Date: |
Mon, 31 Oct 2016 18:25:41 +0100 |
From: Alberto Garcia <address@hidden>
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>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/commit.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/commit.c b/block/commit.c
index 499ecca..a5e17f6 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);
--
1.8.3.1
- [Qemu-block] [PULL 00/29] Block layer patches, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 04/29] block/ssh: Use InetSocketAddress options, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 01/29] block/ssh: Add ssh_has_filename_options_conflict(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 05/29] qapi: allow blockdev-add for ssh, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 06/29] block: Add bdrv_drain_all_{begin,end}(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 03/29] block/ssh: Add InetSocketAddress and accept it, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 02/29] util/qemu-sockets: Make inet_connect_saddr() public, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 08/29] block: Add block_job_add_bdrv(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 07/29] block: Pause all jobs during bdrv_reopen_multiple(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 09/29] block: Use block_job_add_bdrv() in mirror_start_job(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 12/29] block: Block all nodes involved in the block-commit operation,
Kevin Wolf <=
- [Qemu-block] [PULL 10/29] block: Use block_job_add_bdrv() in backup_start(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 11/29] block: Check blockers in all nodes involved in a block-commit job, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 13/29] block: Block all intermediate nodes in commit_active_start(), Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 14/29] block: Support streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 15/29] block: Add QMP support for streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 16/29] docs: Document how to stream to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 17/29] qemu-iotests: Test streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 18/29] qemu-iotests: Test block-stream operations in parallel, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 20/29] qemu-iotests: Test block-stream and block-commit in parallel, Kevin Wolf, 2016/10/31
- [Qemu-block] [PULL 19/29] qemu-iotests: Test overlapping stream and commit operations, Kevin Wolf, 2016/10/31