[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NA
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NAME |
Date: |
Thu, 13 Jul 2017 09:52:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/07/2017 03:30 PM, Eric Blake wrote:
> Reply directly in nbd_negotiate_handle_export_name(), rather than
> waiting until nbd_negotiate_options() completes. This will make it
> easier to implement NBD_OPT_GO. Pass additional parameters around,
> rather than stashing things inside NBDClient.
>
> Signed-off-by: Eric Blake <address@hidden>
>
> ---
> v5: new patch
> ---
> static int nbd_negotiate_handle_export_name(NBDClient *client, uint32_t
> length,
> + uint16_t myflags, bool no_zeroes,
> Error **errp)
> {
> char name[NBD_MAX_NAME_SIZE + 1];
> + char buf[8 + 4 + 124] = "";
Ouch, this is sized 2 bytes too large (it was copying from old-style
negotiation, which sends 4 bytes instead of 2 for the flags after the name).
> + trace_nbd_negotiate_new_style_size_flags(client->exp->size,
> + client->exp->nbdflags |
> myflags);
> + stq_be_p(buf, client->exp->size);
> + stw_be_p(buf + 8, client->exp->nbdflags | myflags);
> + len = no_zeroes ? 10 : sizeof(buf);
> + ret = nbd_write(client->ioc, buf, len, errp);
which means we are breaking things by sending too much.
I'll submit the followup patch shortly, assuming Paolo's v1 pull request
doesn't get held up for any other reason.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v5 2/9] nbd: Don't bother tracing an NBD_OPT_ABORT response failure, (continued)
[Qemu-devel] [PATCH v5 4/9] nbd: Simplify trace of client flags in negotiation, Eric Blake, 2017/07/07
[Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NAME, Eric Blake, 2017/07/07
- Re: [Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NAME,
Eric Blake <=
[Qemu-devel] [PATCH v5 3/9] nbd: Expose and debug more NBD constants, Eric Blake, 2017/07/07
[Qemu-devel] [PATCH v5 8/9] nbd: Implement NBD_INFO_BLOCK_SIZE on server, Eric Blake, 2017/07/07
[Qemu-devel] [PATCH v5 7/9] nbd: Implement NBD_OPT_GO on client, Eric Blake, 2017/07/07
Re: [Qemu-devel] [PATCH v5 7/9] nbd: Implement NBD_OPT_GO on client, Vladimir Sementsov-Ogievskiy, 2017/07/19