[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 16/16] quorum: validate vote threshold against num_ch
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 16/16] quorum: validate vote threshold against num_children even if read-pattern is fifo |
Date: |
Fri, 4 Sep 2015 22:10:47 +0200 |
From: Wen Congyang <address@hidden>
We need to use threshold to check if too many write operation fails.
If threshold is larger than num children, we always get write error
event even if all write operations success.
Signed-off-by: Wen Congyang <address@hidden>
Message-id: address@hidden
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/quorum.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/block/quorum.c b/block/quorum.c
index 2f6c45f..8fe53b4 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -889,6 +889,12 @@ static int quorum_open(BlockDriverState *bs, QDict
*options, int flags,
}
s->threshold = qemu_opt_get_number(opts, QUORUM_OPT_VOTE_THRESHOLD, 0);
+ /* and validate it against s->num_children */
+ ret = quorum_valid_threshold(s->threshold, s->num_children, &local_err);
+ if (ret < 0) {
+ goto exit;
+ }
+
ret = parse_read_pattern(qemu_opt_get(opts, QUORUM_OPT_READ_PATTERN));
if (ret < 0) {
error_setg(&local_err, "Please set read-pattern as fifo or quorum");
@@ -897,12 +903,6 @@ static int quorum_open(BlockDriverState *bs, QDict
*options, int flags,
s->read_pattern = ret;
if (s->read_pattern == QUORUM_READ_PATTERN_QUORUM) {
- /* and validate it against s->num_children */
- ret = quorum_valid_threshold(s->threshold, s->num_children,
&local_err);
- if (ret < 0) {
- goto exit;
- }
-
/* is the driver in blkverify mode */
if (qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, false) &&
s->num_children == 2 && s->threshold == 2) {
--
1.8.3.1
- [Qemu-block] [PULL 06/16] block/raw-posix: Use raw_normalize_devicepath(), (continued)
- [Qemu-block] [PULL 06/16] block/raw-posix: Use raw_normalize_devicepath(), Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 08/16] iotests: More options for VM.add_drive(), Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 07/16] qemu-img: Fix crash in amend invocation, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 09/16] iotests: Respect -nodefaults in tests 41 and 55, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 11/16] iotests: Warn if python subprocess is killed, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 10/16] iotests: Do not suppress segfaults in bash tests, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 12/16] qcow2: mark the memory as no longer needed after qcow2_cache_empty(), Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 15/16] qcow2: reorder fields in Qcow2CachedTable to reduce padding, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 13/16] qcow2: add option to clean unused cache entries after some time, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 14/16] docs: document how to configure the qcow2 L2/refcount caches, Kevin Wolf, 2015/09/04
- [Qemu-block] [PULL 16/16] quorum: validate vote threshold against num_children even if read-pattern is fifo,
Kevin Wolf <=
- Re: [Qemu-block] [Qemu-devel] [PULL 00/16] Block patches, Peter Maydell, 2015/09/07