[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 03/27] mirror: Fix permissions for removing mirror_to
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 03/27] mirror: Fix permissions for removing mirror_top_bs |
Date: |
Tue, 7 Mar 2017 16:40:27 +0100 |
mirror_top_bs takes write permissions on its backing file, which can
make it impossible to attach that backing file node to another parent.
However, this is exactly what needs to be done in order to remove
mirror_top_bs from the backing chain. So give up the write permission
first.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block/mirror.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/mirror.c b/block/mirror.c
index c9185b3..001b5f0 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -566,8 +566,10 @@ static void mirror_exit(BlockJob *job, void *opaque)
/* Remove the mirror filter driver from the graph. Before this, get rid of
* the blockers on the intermediate nodes so that the resulting state is
- * valid. */
+ * valid. Also give up permissions on mirror_top_bs->backing, which might
+ * block the removal. */
block_job_remove_all_bdrv(job);
+ bdrv_child_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL);
bdrv_replace_in_backing_chain(mirror_top_bs, backing_bs(mirror_top_bs));
/* We just changed the BDS the job BB refers to (with either or both of the
@@ -1234,6 +1236,7 @@ fail:
block_job_unref(&s->common);
}
+ bdrv_child_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL);
bdrv_replace_in_backing_chain(mirror_top_bs, backing_bs(mirror_top_bs));
}
--
1.8.3.1
- [Qemu-block] [PULL 00/27] Block layer fixes for 2.9.0-rc0, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 03/27] mirror: Fix permissions for removing mirror_top_bs,
Kevin Wolf <=
- [Qemu-block] [PULL 01/27] commit: Fix error handling, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 02/27] mirror: Fix permission problem with 'replaces', Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 05/27] block: Fix blockdev-snapshot error handling, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 04/27] mirror: Fix error path for dirty bitmap creation, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 07/27] block: Factor out bdrv_replace_child_noperm(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 06/27] block: Factor out should_update_child(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 08/27] block: Ignore multiple children in bdrv_check_update_perm(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 11/27] sheepdog: Defuse time bomb in sd_open() error handling, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 09/27] block: Handle permission errors in change_parent_backing_link(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 10/27] block: Fix error handling in bdrv_replace_in_backing_chain(), Kevin Wolf, 2017/03/07