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 <[email protected]> > > --- > 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
