All of lore.kernel.org
 help / color / mirror / Atom feed
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 v5 06/11] nbd: Minimal structured read for server
Date: Sat, 21 Oct 2017 11:02:15 -0500	[thread overview]
Message-ID: <5e3d7dc8-a186-fa1f-4f0f-9e4ee20bf187@redhat.com> (raw)
In-Reply-To: <821df5a9-bc7d-a2d9-140f-4bd4e0bd72b1@virtuozzo.com>

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

On 10/20/2017 02:30 PM, Vladimir Sementsov-Ogievskiy wrote:

>>>> +                } else if (client->structured_reply) {
>>>> +                    ret = nbd_negotiate_send_rep_err(
>>>> +                        client->ioc, NBD_REP_ERR_INVALID, option,
>>>> errp,
>>>> +                        "structured reply already negotiated");
>>>> +                } else {
>>>> +                    ret = nbd_negotiate_send_rep(client->ioc,
>>>> NBD_REP_ACK,
>>>> +                                                 option, errp);
>>>> +                }
>>> you've dropped "if (ret < 0) { return ret }", but the following two
>>> lines should not be
>>> executed if ret < 0.. May be it doesn't matter (we will abort connection
>>> anyway after switch {}) but
>>> it looks strange.
>>>
>>>> +                client->structured_reply = true;
>>>> +                myflags |= NBD_FLAG_SEND_DF;
>>>> +                break;
>> Indeed, these two lines are harmless due to the catch-all 'ret < 0'
>> after the switch at the tail end of the loop (which is why I dropped the
>> 'if' here).
>>
>>
> 
> yes. but it looks strange) Anyway,
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> 

On second thought, modifying client->structured_reply when we
successfully replied with an error is wrong.  So v6 will hoist the
modifications into the last else branch.

-- 
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 --]

  reply	other threads:[~2017-10-23 11:51 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 22:26 [Qemu-devel] [PATCH v5 00/11] nbd minimal structured read Eric Blake
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 01/11] nbd: Include error names in trace messages Eric Blake
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 02/11] nbd: Move nbd_errno_to_system_errno() to public header Eric Blake
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 03/11] nbd: Expose constants and structs for structured read Eric Blake
2017-10-20  8:00   ` Vladimir Sementsov-Ogievskiy
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 04/11] nbd/server: Report error for write to read-only export Eric Blake
2017-10-20  8:06   ` Vladimir Sementsov-Ogievskiy
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 05/11] nbd/server: Refactor zero-length option check Eric Blake
2017-10-20  8:34   ` Vladimir Sementsov-Ogievskiy
2017-10-20 15:07     ` Eric Blake
2017-10-20 18:12       ` Vladimir Sementsov-Ogievskiy
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 06/11] nbd: Minimal structured read for server Eric Blake
2017-10-20 19:03   ` Vladimir Sementsov-Ogievskiy
2017-10-20 19:11     ` Eric Blake
2017-10-20 19:30       ` Vladimir Sementsov-Ogievskiy
2017-10-21 16:02         ` Eric Blake [this message]
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 07/11] nbd/server: Include human-readable message in structured errors Eric Blake
2017-10-20 19:08   ` Vladimir Sementsov-Ogievskiy
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 08/11] nbd/client: refactor nbd_receive_starttls Eric Blake
2017-10-20 19:26   ` Vladimir Sementsov-Ogievskiy
2017-10-20 19:33     ` Eric Blake
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 09/11] nbd/client: prepare nbd_receive_reply for structured reply Eric Blake
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 10/11] nbd: Move nbd_read() to common header Eric Blake
2017-10-19 22:26 ` [Qemu-devel] [PATCH v5 11/11] nbd: Minimal structured read for client Eric Blake
2017-10-20 19:58   ` Vladimir Sementsov-Ogievskiy
2017-10-20 20:46     ` Eric Blake
2017-10-23 11:57   ` Eric Blake
2017-10-23 12:24     ` Vladimir Sementsov-Ogievskiy
2017-10-24  7:31   ` Eric Blake
2017-10-19 23:07 ` [Qemu-devel] [PATCH v5 00/11] nbd minimal structured read no-reply
2017-10-20 15:09   ` 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=5e3d7dc8-a186-fa1f-4f0f-9e4ee20bf187@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.