qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org
Cc: stefanha@redhat.com, pbonzini@redhat.com, den@openvz.org,
	"Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/6] nbd/server: use errp instead of LOG
Date: Fri, 7 Jul 2017 09:40:29 -0500	[thread overview]
Message-ID: <b8174b0b-1782-48ae-6bef-3f2a6a08f025@redhat.com> (raw)
In-Reply-To: <20170621153424.16690-3-vsementsov@virtuozzo.com>

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]

On 06/21/2017 10:34 AM, Vladimir Sementsov-Ogievskiy wrote:
> Move to modern errp scheme from just LOGging errors.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  nbd/server.c | 268 +++++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 161 insertions(+), 107 deletions(-)

> -static coroutine_fn int nbd_negotiate(NBDClient *client)
> +static coroutine_fn int nbd_negotiate(NBDClient *client, Error **errp)
>  {
>      char buf[8 + 8 + 8 + 128];
>      int ret;

Now that you have this,

>     qio_channel_set_blocking(client->ioc, false, NULL);
> 

you should probably pass errp through to qio_channel_set_blocking and
return early if that fails (either here or in one of the followup
patches) [hmm, I note that most callers of qio_channel_set_blocking()
ignore errors - outside of NBD, so that's a separate cleanup series]


> @@ -591,21 +617,23 @@ static coroutine_fn int nbd_negotiate(NBDClient *client)
>  
>      if (oldStyle) {
>          if (client->tlscreds) {
> -            TRACE("TLS cannot be enabled with oldstyle protocol");
> +            error_setg(errp, "TLS cannot be enabled with oldstyle protocol");
>              return -EINVAL;

This code is unreachable, since earlier we have:

>     oldStyle = client->exp != NULL && !client->tlscreds;

You could just as easily delete the conditional.  In fact, our code has:

if (oldStyle) {
    do stuff
} else {
    do stuff
}

if (oldStyle) {
    do stuff
} else {
    do stuff
}

and it would be simple to merge that into a single if statement.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2017-07-07 14:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 15:34 [Qemu-devel] [PATCH v2 0/6] nbd refactoring part 2 Vladimir Sementsov-Ogievskiy
2017-06-21 15:34 ` [Qemu-devel] [PATCH v2 1/6] nbd/server: nbd_negotiate: return 1 on NBD_OPT_ABORT Vladimir Sementsov-Ogievskiy
2017-06-29 18:46   ` Eric Blake
2017-07-06 16:07     ` Eric Blake
2017-06-21 15:34 ` [Qemu-devel] [PATCH v2 2/6] nbd/server: use errp instead of LOG Vladimir Sementsov-Ogievskiy
2017-06-29 19:27   ` Eric Blake
2017-07-05 12:33     ` Vladimir Sementsov-Ogievskiy
2017-07-05 15:21       ` Paolo Bonzini
2017-07-05 17:38     ` Markus Armbruster
2017-07-07 14:40   ` Eric Blake [this message]
2017-07-07 15:10     ` Vladimir Sementsov-Ogievskiy
2017-06-21 15:34 ` [Qemu-devel] [PATCH v2 3/6] nbd/server: add errp to nbd_send_reply() Vladimir Sementsov-Ogievskiy
2017-06-29 19:31   ` Eric Blake
2017-06-21 15:34 ` [Qemu-devel] [PATCH v2 4/6] nbd/common: nbd_tls_handshake: remove extra TRACE Vladimir Sementsov-Ogievskiy
2017-06-29 19:32   ` Eric Blake
2017-06-21 15:34 ` [Qemu-devel] [PATCH v2 5/6] nbd/client: refactor TRACE of NBD_MAGIC Vladimir Sementsov-Ogievskiy
2017-06-29 19:36   ` Eric Blake
2017-07-05 15:21     ` Paolo Bonzini
2017-06-21 15:34 ` [Qemu-devel] [PATCH v2 6/6] nbd: use generic trace subsystem instead of TRACE macro Vladimir Sementsov-Ogievskiy
2017-06-29 20:12   ` Eric Blake
2017-07-06 14:49     ` Eric Blake
2017-07-05 15:29   ` Paolo Bonzini
2017-07-06  8:45     ` Vladimir Sementsov-Ogievskiy
2017-07-06  8:57       ` Paolo Bonzini
2017-07-06 15:01   ` Eric Blake
2017-07-06 15:28   ` Eric Blake
2017-07-06 15:44   ` Eric Blake
2017-07-07 14:02     ` Vladimir Sementsov-Ogievskiy

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=b8174b0b-1782-48ae-6bef-3f2a6a08f025@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.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).