From: Peter Xu <peterx@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [PATCH] migration/rdma: rdma_accept_incoming_migration fix error handling
Date: Tue, 11 Feb 2020 08:49:58 -0500 [thread overview]
Message-ID: <20200211134958.GE984290@xz-x1> (raw)
In-Reply-To: <20200211092200.GC2751@work-vm>
On Tue, Feb 11, 2020 at 09:22:00AM +0000, Dr. David Alan Gilbert wrote:
> * Peter Xu (peterx@redhat.com) wrote:
> > On Mon, Feb 10, 2020 at 07:44:59PM +0000, Dr. David Alan Gilbert (git) wrote:
> > > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > >
> > > rdma_accept_incoming_migration is called from an fd handler and
> > > can't return an Error * anywhere.
> > > Currently it's leaking Error's in errp/local_err - there's
> > > no point putting them in there unless we can report them.
> > >
> > > Turn most into fprintf's, and the last into an error_reportf_err
> > > where it's coming up from another function.
> > >
> > > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > > ---
> > > migration/rdma.c | 11 +++++++----
> > > 1 file changed, 7 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/migration/rdma.c b/migration/rdma.c
> > > index 2379b8345b..f67161c98f 100644
> > > --- a/migration/rdma.c
> > > +++ b/migration/rdma.c
> > > @@ -3980,13 +3980,13 @@ static void rdma_accept_incoming_migration(void *opaque)
> > > RDMAContext *rdma = opaque;
> > > int ret;
> > > QEMUFile *f;
> > > - Error *local_err = NULL, **errp = &local_err;
> > > + Error *local_err = NULL;
> > >
> > > trace_qemu_rdma_accept_incoming_migration();
> > > ret = qemu_rdma_accept(rdma);
> > >
> > > if (ret) {
> > > - ERROR(errp, "RDMA Migration initialization failed!");
> > > + fprintf(stderr, "RDMA ERROR: Migration initialization failed");
> >
> > Is there any reason to explictly use stderr instead of the
> > error_reportf_err() below (then we simply jump to that for error
> > paths)? The only difference of error_reportf_err() and stderr should
> > be when there's one HMP, while shall we always suggest to use
> > error_reportf_err() rather than stderr?
>
> Because the error_reportf_err is taking an Error* (from an error
> reported by migration_fd_process_incoming) where as we don't have an
> Error* at the earlier points.
The ERROR() macro in rdma.c created them? Though it also prints to
stderr so if we also use the same error_reportf_err() then we can
remove that prints to stderr too.
--
Peter Xu
next prev parent reply other threads:[~2020-02-11 13:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 19:44 [PATCH] migration/rdma: rdma_accept_incoming_migration fix error handling Dr. David Alan Gilbert (git)
2020-02-10 22:33 ` Peter Xu
2020-02-11 9:22 ` Dr. David Alan Gilbert
2020-02-11 13:49 ` Peter Xu [this message]
2020-02-11 11:10 ` Juan Quintela
2020-02-11 11:15 ` Dr. David Alan Gilbert
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=20200211134958.GE984290@xz-x1 \
--to=peterx@redhat.com \
--cc=dgilbert@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).