From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVBND-0000uH-GZ for qemu-devel@nongnu.org; Mon, 15 Feb 2016 00:07:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVBNA-0004yZ-Ah for qemu-devel@nongnu.org; Mon, 15 Feb 2016 00:06:59 -0500 Received: from [59.151.112.132] (port=36965 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVBN9-0004vy-S8 for qemu-devel@nongnu.org; Mon, 15 Feb 2016 00:06:56 -0500 Message-ID: <56C15D38.3010409@cn.fujitsu.com> Date: Mon, 15 Feb 2016 13:08:08 +0800 From: Changlong Xie MIME-Version: 1.0 References: <1454639122-14027-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <56B4C3D7.4040404@redhat.com> In-Reply-To: <56B4C3D7.4040404@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu devel , Alberto Garcia , Kevin Wolf Cc: "Dr. David Alan Gilbert" On 02/05/2016 11:46 PM, Eric Blake wrote: > On 02/04/2016 07:25 PM, Changlong Xie wrote: >> Signed-off-by: Wen Congyang >> Signed-off-by: Changlong Xie >> --- >> block/quorum.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/block/quorum.c b/block/quorum.c >> index a5ae4b8..11cc60b 100644 >> --- a/block/quorum.c >> +++ b/block/quorum.c >> @@ -286,7 +286,8 @@ static void quorum_aio_cb(void *opaque, int ret) >> >> if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) { >> /* We try to read next child in FIFO order if we fail to read */ >> - if (ret < 0 && ++acb->child_iter < s->num_children) { >> + if (ret < 0 && (acb->child_iter + 1) < s->num_children) { > > Could shorten this as > if (ret < 0 && acb->child_iter <= s->num_children) { > but I'm not sure it's worth the mental gymnastics. Hi Eric Just the same to me. Since it has been applied to block branch. Let's keep the original one. Thanks -Xie >