From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com, lvivier@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 3/6] migration/rdma: fix qemu_rdma_block_for_wrid error paths
Date: Tue, 18 Jul 2017 20:04:02 +0100 [thread overview]
Message-ID: <20170718190402.GG2106@work-vm> (raw)
In-Reply-To: <20170718012042.GW27284@pxdev.xzpeter.org>
* Peter Xu (peterx@redhat.com) wrote:
> On Mon, Jul 17, 2017 at 12:09:33PM +0100, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > The two places that 'goto err_block_for_wrid' weren't setting ret
> > and so would end up returning 0 even though we've failed.
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> > migration/rdma.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/migration/rdma.c b/migration/rdma.c
> > index 6111e10c70..59810aec2e 100644
> > --- a/migration/rdma.c
> > +++ b/migration/rdma.c
> > @@ -1521,14 +1521,16 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested,
> > yield_until_fd_readable(rdma->comp_channel->fd);
> > }
> >
> > - if (ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx)) {
> > + ret = ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx);
> > + if (ret) {
> > perror("ibv_get_cq_event");
> > goto err_block_for_wrid;
> > }
> >
> > num_cq_events++;
> >
> > - if (ibv_req_notify_cq(cq, 0)) {
> > + ret = -ibv_req_notify_cq(cq, 0);
>
> (I didn't really notice that it is returning a positive value for
> error...)
Yes, the manpage said that and I followed it into the source to check;
none of the ibv interfaces are in any way consistent.
From the manpage:
ibv_get_cq_event() returns 0 on success, and -1 on error.
ibv_ack_cq_events() returns no value.
ibv_req_notify_cq() returns 0 on success, or the value of errno on failure
etc
(and -1 will do as a ret value if we havent got a real errno)
Dave
> Reviewed-by: Peter Xu <peterx@redhat.com>
>
> > + if (ret) {
> > goto err_block_for_wrid;
> > }
> >
> > @@ -1564,6 +1566,8 @@ err_block_for_wrid:
> > if (num_cq_events) {
> > ibv_ack_cq_events(cq, num_cq_events);
> > }
> > +
> > + rdma->error_state = ret;
> > return ret;
> > }
> >
> > --
> > 2.13.0
> >
>
> --
> Peter Xu
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-07-18 19:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 11:09 [Qemu-devel] [PATCH v4 0/6] A bunch of RDMA fixes Dr. David Alan Gilbert (git)
2017-07-17 11:09 ` [Qemu-devel] [PATCH v4 1/6] migration/rdma: Fix race on source Dr. David Alan Gilbert (git)
2017-07-17 11:09 ` [Qemu-devel] [PATCH v4 2/6] migration: Close file on failed migration load Dr. David Alan Gilbert (git)
2017-07-17 19:49 ` Juan Quintela
2017-07-17 11:09 ` [Qemu-devel] [PATCH v4 3/6] migration/rdma: fix qemu_rdma_block_for_wrid error paths Dr. David Alan Gilbert (git)
2017-07-18 1:20 ` Peter Xu
2017-07-18 19:04 ` Dr. David Alan Gilbert [this message]
2017-07-17 11:09 ` [Qemu-devel] [PATCH v4 4/6] migration/rdma: Allow cancelling while waiting for wrid Dr. David Alan Gilbert (git)
2017-07-18 1:23 ` Peter Xu
2017-07-17 11:09 ` [Qemu-devel] [PATCH v4 5/6] migration/rdma: Safely convert control types Dr. David Alan Gilbert (git)
2017-07-17 16:20 ` Juan Quintela
2017-07-17 11:09 ` [Qemu-devel] [PATCH v4 6/6] migration/rdma: Send error during cancelling Dr. David Alan Gilbert (git)
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=20170718190402.GG2106@work-vm \
--to=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).