[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Block v6 06/16] Don't allow a disk use backing
From: |
Wen Congyang |
Subject: |
[Qemu-devel] [PATCH COLO-Block v6 06/16] Don't allow a disk use backing reference target |
Date: |
Thu, 18 Jun 2015 16:49:11 +0800 |
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
block.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block.c b/block.c
index d1ed227..0b41af4 100644
--- a/block.c
+++ b/block.c
@@ -1294,6 +1294,14 @@ static int
bdrv_open_backing_reference_file(BlockDriverState *bs,
}
backing_hd = blk_bs(backing_blk);
+ /* Don't allow a disk use backing reference target */
+ ret = blk_attach_dev(backing_hd->blk, bs);
+ if (ret < 0) {
+ error_setg(errp, "backing_hd %s is used by the other device model",
+ backing_name);
+ goto free_exit;
+ }
+
/* Backing reference itself? */
if (backing_hd == bs || bdrv_find_overlay(backing_hd, bs)) {
error_setg(errp, "Backing reference itself");
@@ -2037,6 +2045,7 @@ void bdrv_close(BlockDriverState *bs)
if (backing_hd->backing_hd->job) {
block_job_cancel(backing_hd->backing_hd->job);
}
+ blk_detach_dev(backing_hd->backing_hd->blk, bs);
bdrv_set_backing_hd(backing_hd, NULL);
bdrv_unref(backing_hd->backing_hd);
}
--
2.4.3
- [Qemu-devel] [PATCH COLO-Block v6 00/16] Block replication for continuous checkpoints, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 01/16] docs: block replication's description, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 03/16] Allow creating backup jobs when opening BDS, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 02/16] allow writing to the backing file, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 05/16] Backup: clear all bitmap when doing block checkpoint, Wen Congyang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Block v6 06/16] Don't allow a disk use backing reference target,
Wen Congyang <=
- [Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/18
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/19
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Wen Congyang, 2015/06/19
- Re: [Qemu-devel] [Qemu-block] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target, Stefan Hajnoczi, 2015/06/22