From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAweP-0000ve-Hz for qemu-devel@nongnu.org; Fri, 03 Jul 2015 04:48:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAweM-0004nM-Bo for qemu-devel@nongnu.org; Fri, 03 Jul 2015 04:48:49 -0400 Received: from [59.151.112.132] (port=50307 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAweK-0003QA-1m for qemu-devel@nongnu.org; Fri, 03 Jul 2015 04:48:46 -0400 Message-ID: <55964CEA.4010907@cn.fujitsu.com> Date: Fri, 3 Jul 2015 16:50:50 +0800 From: Wen Congyang MIME-Version: 1.0 References: <55962F72.3060003@cn.fujitsu.com> In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] quorum: validate vote threshold against num_children even if read-pattern is fifo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devl Cc: Liu Yuan , Stefan Hajnoczi On 07/03/2015 04:41 PM, Alberto Garcia wrote: > On Fri 03 Jul 2015 08:45:06 AM CEST, Wen Congyang wrote: > >> 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 >> --- >> block/quorum.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/block/quorum.c b/block/quorum.c >> index a7df17c..b0eead0 100644 >> --- a/block/quorum.c >> +++ b/block/quorum.c >> @@ -894,6 +894,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; >> + } >> + > > I wonder why this check was moved inside the (s->read_pattern == > QUORUM_READ_PATTERN_QUORUM) block when the fifo mode was introduced > (adding Liu Yuan to Cc). > > I assume that you are not going to allow removing children under the > vote_threshold limit as we discussed, right? Yes. Thanks Wen Congyang > > Reviewed-by: Alberto Garcia > > Berto > . >