[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/36] quorum: Forbid adding children in blkverify mo
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 17/36] quorum: Forbid adding children in blkverify mode |
Date: |
Mon, 5 Nov 2018 17:37:25 +0100 |
From: Alberto Garcia <address@hidden>
The blkverify mode of Quorum only works when the number of children is
exactly two, so any attempt to add a new one must return an error.
quorum_del_child() on the other hand doesn't need any additional check
because decreasing the number of children would make it go under the
vote threshold.
Signed-off-by: Alberto Garcia <address@hidden>
Reported-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/quorum.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/block/quorum.c b/block/quorum.c
index 6188ff6666..16b3c8067c 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -992,6 +992,11 @@ static void quorum_add_child(BlockDriverState *bs,
BlockDriverState *child_bs,
char indexstr[32];
int ret;
+ if (s->is_blkverify) {
+ error_setg(errp, "Cannot add a child to a quorum in blkverify mode");
+ return;
+ }
+
assert(s->num_children <= INT_MAX / sizeof(BdrvChild *));
if (s->num_children == INT_MAX / sizeof(BdrvChild *) ||
s->next_child_index == UINT_MAX) {
@@ -1046,6 +1051,9 @@ static void quorum_del_child(BlockDriverState *bs,
BdrvChild *child,
return;
}
+ /* We know now that num_children > threshold, so blkverify must be false */
+ assert(!s->is_blkverify);
+
bdrv_drained_begin(bs);
/* We can safely remove this child now */
--
2.19.1
- Re: [Qemu-devel] [PULL 29/36] qemu-iotests: Test auto-read-only with -drive and -blockdev, (continued)
- [Qemu-devel] [PULL 24/36] file-posix: Support auto-read-only option, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 21/36] rbd: Close image in qemu_rbd_open() error path, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 26/36] gluster: Support auto-read-only option, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 36/36] include: Add a comment to explain the origin of sizes' lookup table, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 33/36] object: Make option help nicer to read, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 25/36] curl: Support auto-read-only option, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 27/36] iscsi: Support auto-read-only option, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 13/36] block/vdi: Don't take address of fields in packed structs, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 16/36] iotest: Test the blkverify mode of the Quorum driver, Kevin Wolf, 2018/11/05
- [Qemu-devel] [PULL 17/36] quorum: Forbid adding children in blkverify mode,
Kevin Wolf <=
- Re: [Qemu-devel] [PULL 00/36] Block layer patches, Peter Maydell, 2018/11/05