All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Cc: Alberto Garcia <berto@igalia.com>,
	qemu devel <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode
Date: Thu, 4 Feb 2016 13:24:33 +0100	[thread overview]
Message-ID: <20160204122433.GA2314@noname> (raw)
In-Reply-To: <1454581157-9858-1-git-send-email-xiecl.fnst@cn.fujitsu.com>

Am 04.02.2016 um 11:19 hat Changlong Xie geschrieben:
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
>  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.

Kevin

  reply	other threads:[~2016-02-04 12:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04 10:19 [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode Changlong Xie
2016-02-04 12:24 ` Kevin Wolf [this message]
2016-02-05  1:57   ` Changlong Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160204122433.GA2314@noname \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiecl.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.