qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	sheepdog@lists.wpkg.org, qemu-block@nongnu.org,
	Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>,
	Jeff Cody <jcody@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Liu Yuan <namei.unix@gmail.com>, Fam Zheng <famz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] sheepdog: Set error when connection fails
Date: Fri, 21 Apr 2017 09:31:37 +0100	[thread overview]
Message-ID: <20170421083137.GD27925@redhat.com> (raw)
In-Reply-To: <87pog61fjr.fsf@dusky.pond.sub.org>

On Fri, Apr 21, 2017 at 07:43:36AM +0200, Markus Armbruster wrote:
> Kevin Wolf <kwolf@redhat.com> writes:
> 
> > Am 20.04.2017 um 17:30 hat Daniel P. Berrange geschrieben:
> >> On Thu, Apr 20, 2017 at 12:00:03PM +0800, Fam Zheng wrote:
> >> > Signed-off-by: Fam Zheng <famz@redhat.com>
> >> > ---
> >> >  block/sheepdog.c | 1 +
> >> >  1 file changed, 1 insertion(+)
> >> > 
> >> > diff --git a/block/sheepdog.c b/block/sheepdog.c
> >> > index fb9203e..7e889ee 100644
> >> > --- a/block/sheepdog.c
> >> > +++ b/block/sheepdog.c
> >> > @@ -608,6 +608,7 @@ static int connect_to_sdog(BDRVSheepdogState *s, Error **errp)
> >> >          qemu_set_nonblock(fd);
> >> >      } else {
> >> >          fd = -EIO;
> >> > +        error_setg(errp, "Failed to connect to sheepdog server");
> >> >      }
> >> 
> >> This doesn't make much sense to me. The lines just above the
> >> diff context have this:
> >> 
> >>     fd = socket_connect(s->addr, errp, NULL, NULL);
> >> 
> >> socket_connect should have already reported an error on "errp"
> >> in the scenario that 'fd == -1'.
> >
> > By the way, am I the only one who thinks that having errp anywhere else
> > than as the last argument is bad style? I can easily see myself missing
> > that this functions sets it because the last argument is NULL.
> 
> Yes, it's bad style because it's suprising.  Worth fixing.

In fact we can simply delete the last two arguments to socket_connect()
entirely. Most code is now switched over to use QIOChannel APIs, so we
don't have anything which uses the non-blocking connect feature of
socket_connect() anymore.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2017-04-21  8:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  4:00 [Qemu-devel] [PATCH] sheepdog: Set error when connection fails Fam Zheng
2017-04-20  9:12 ` Philippe Mathieu-Daudé
2017-04-20 15:21 ` Jeff Cody
2017-04-20 15:23 ` Jeff Cody
2017-04-20 15:30 ` Daniel P. Berrange
2017-04-20 15:42   ` Jeff Cody
2017-04-20 15:45     ` Daniel P. Berrange
2017-04-20 20:32   ` Kevin Wolf
2017-04-20 20:40     ` Jeff Cody
2017-04-21  0:19     ` Fam Zheng
2017-04-21  5:43     ` Markus Armbruster
2017-04-21  8:31       ` Daniel P. Berrange [this message]
2017-04-21  8:50         ` Fam Zheng
2017-04-21 10:06           ` Daniel P. Berrange

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=20170421083137.GD27925@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mitake.hitoshi@lab.ntt.co.jp \
    --cc=mreitz@redhat.com \
    --cc=namei.unix@gmail.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sheepdog@lists.wpkg.org \
    /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).