From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRVdL-00053L-NO for qemu-devel@nongnu.org; Thu, 04 Feb 2016 20:56:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRVdH-0000U0-3Z for qemu-devel@nongnu.org; Thu, 04 Feb 2016 20:56:27 -0500 Received: from [59.151.112.132] (port=27740 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRVdF-0000Tv-JC for qemu-devel@nongnu.org; Thu, 04 Feb 2016 20:56:23 -0500 Message-ID: <56B40184.4050000@cn.fujitsu.com> Date: Fri, 5 Feb 2016 09:57:24 +0800 From: Changlong Xie MIME-Version: 1.0 References: <1454581157-9858-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <20160204122433.GA2314@noname> In-Reply-To: <20160204122433.GA2314@noname> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Alberto Garcia , qemu devel , "Dr. David Alan Gilbert" On 02/04/2016 08:24 PM, Kevin Wolf wrote: > Am 04.02.2016 um 11:19 hat Changlong Xie geschrieben: >> Signed-off-by: Wen Congyang >> Signed-off-by: Changlong Xie >> --- >> block/quorum.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/block/quorum.c b/block/quorum.c >> index a5ae4b8..0965277 100644 >> --- a/block/quorum.c >> +++ b/block/quorum.c >> @@ -295,6 +295,9 @@ static void quorum_aio_cb(void *opaque, int ret) >> quorum_copy_qiov(acb->qiov, &acb->qcrs[acb->child_iter].qiov); >> } >> acb->vote_ret = ret; >> + if (ret < 0) { >> + acb->child_iter--; >> + } >> quorum_aio_finalize(acb); >> return; >> } > > This looks semantically correct to me (but I'd like to have an Ack from > Berto), but I would fix it above: We shouldn't do ++acb->child_iter in > the first place if the new value is >= s->num_children. So instead of > decrementing after the fact, just move the increment to inside the then > branch above. Yes, will fix in next version. Thanks -Xie > > Kevin > > > . >