From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v6 06/12] nbd/server: Refactor zero-length option check
Date: Mon, 30 Oct 2017 21:46:31 +0100 [thread overview]
Message-ID: <6d682400-5be5-fce2-0742-d935c77889fa@redhat.com> (raw)
In-Reply-To: <5b8fbdd6-c3cd-aed8-f633-ad5f0d07507d@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
On 10/30/2017 09:11 PM, Eric Blake wrote:
> On 10/30/2017 06:22 PM, Vladimir Sementsov-Ogievskiy wrote:
>> 27.10.2017 13:40, Eric Blake wrote:
>>> Consolidate the response for a non-zero-length option payload
>>> into a new function, nbd_reject_length(). This check will
>>> also be used when introducing support for structured replies.
>>>
>>> + if (length) {
>>> + /* Unconditionally drop the connection if the client
>>> + * can't start a TLS negotiation correctly */
>>> + nbd_reject_length(client, length, option, true,
>>> errp);
>>> + return -EINVAL;
>>
>> why not to return nbd_reject_length's result? this EINVAL may not
>> correspond to errp (about EIO for example)..
>
> Somewhat true, if nbd_reject_length() fails. But nbd_reject_length() may
> also return 0 without setting errp, in which case, maybe this code
> should set errp rather than just blindly returning -EINVAL.
>
>>
>> with or without this fixed:
>>
>> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>
>
> Okay, I'll squash this in, and include it in my pull request to be sent
> shortly.
D'oh. Long week for me. The whole reason I added a 'bool fatal'
parameter was so that I don't have to worry about nbd_reject_length()
returning 0. So it is instead better to just do:
> --- i/nbd/server.c
> +++ w/nbd/server.c
> @@ -684,8 +684,13 @@ static int nbd_negotiate_options(NBDClient *client,
> uint16_t myflags,
> if (length) {
> /* Unconditionally drop the connection if the client
> * can't start a TLS negotiation correctly */
> - nbd_reject_length(client, length, option, true, errp);
> - return -EINVAL;
> + return nbd_reject_length(client, length, option, true,
> + errp);
rather than repeating an error message.
--
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: 619 bytes --]
next prev parent reply other threads:[~2017-10-30 20:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 10:40 [Qemu-devel] [PATCH v6 00/12] nbd minimal structured read Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 01/12] nbd: Include error names in trace messages Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 02/12] nbd: Move nbd_errno_to_system_errno() to public header Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 03/12] nbd: Expose constants and structs for structured read Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 04/12] nbd/server: Report error for write to read-only export Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 05/12] nbd/server: Simplify nbd_negotiate_options loop Eric Blake
2017-10-30 16:43 ` Vladimir Sementsov-Ogievskiy
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 06/12] nbd/server: Refactor zero-length option check Eric Blake
2017-10-30 17:22 ` Vladimir Sementsov-Ogievskiy
2017-10-30 20:11 ` Eric Blake
2017-10-30 20:46 ` Eric Blake [this message]
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 07/12] nbd: Minimal structured read for server Eric Blake
2017-10-30 17:30 ` Vladimir Sementsov-Ogievskiy
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 08/12] nbd/server: Include human-readable message in structured errors Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 09/12] nbd/client: refactor nbd_receive_starttls Eric Blake
2017-10-30 17:32 ` Vladimir Sementsov-Ogievskiy
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 10/12] nbd/client: prepare nbd_receive_reply for structured reply Eric Blake
2017-11-13 19:33 ` Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 11/12] nbd: Move nbd_read() to common header Eric Blake
2017-10-27 10:40 ` [Qemu-devel] [PATCH v6 12/12] nbd: Minimal structured read for client Eric Blake
2017-10-30 17:55 ` Vladimir Sementsov-Ogievskiy
2017-10-27 10:45 ` [Qemu-devel] [RFC PATCH v6 13/12] tweak test 83 verbosity Eric Blake
2017-10-30 12:34 ` Vladimir Sementsov-Ogievskiy
2017-10-30 13:00 ` Eric Blake
2017-10-30 18:01 ` Vladimir Sementsov-Ogievskiy
2017-10-27 10:59 ` [Qemu-devel] [PATCH v6 00/12] nbd minimal structured read no-reply
2017-10-27 14:59 ` Eric Blake
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=6d682400-5be5-fce2-0742-d935c77889fa@redhat.com \
--to=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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).