Received: from eggs.gnu.org ([2001:4830:134:3::10]:55977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSTd9-0005wB-W4 for qemu-devel@nongnu.org; Thu, 20 Aug 2015 13:28:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSTd9-0003OI-22 for qemu-devel@nongnu.org; Thu, 20 Aug 2015 13:27:59 -0400 Date: Thu, 20 Aug 2015 19:27:47 +0200 From: Kevin Wolf Message-ID: <20150820172747.GB2349@noname.redhat.com> References: <55962F72.3060003@cn.fujitsu.com> <55D3EF90.3050702@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55D3EF90.3050702@cn.fujitsu.com> 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: Wen Congyang Cc: qemu-block@nongnu.org, Alberto Garcia , qemu-devl , Stefan Hajnoczi Am 19.08.2015 um 04:53 hat Wen Congyang geschrieben: > Ping... It might have helped to... a) CC the qemu-block mailing list b) CC the subsystem maintainer that should apply the patch (according to scripts/get_maintainer.pl that's me with Berto's Acked-by) c) include the "PATCH" keyword in the subject line. I'm copying qemu-block now and will consider the patch once I'm back from KVM Forum. Kevin > On 07/03/2015 02:45 PM, 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; > > + } > > + > > 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"); > > @@ -902,12 +908,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) { > > > >