[adding nbd list] On 06/13/2016 06:10 AM, Paolo Bonzini wrote: > > > On 12/05/2016 00:39, Eric Blake wrote: >> - If we report an error to NBD_CMD_READ, we are not writing out >> any data payload; but the protocol says that a client can expect >> to read the payload no matter what (and must instead ignore it), >> which means the client will start reading our next replies as >> its data payload. Fix by disconnecting (an alternative fix of >> sending bogus payload would be trickier to implement). > > This is an error in the spec. The Linux driver doesn't expect to read > the payload here, and neither does block/nbd-client.c.
That's one of the reasons that there is a proposal to add STRUCTURED_READ to the spec (although I still haven't had time to implement that for qemu), so that we have a newer approach that allows for proper error handling without ambiguity on whether bogus bytes must be sent on a failed read. But you'd have to convince me that ALL existing NBD server and client implementations expect to handle a read error without read payload, otherwise, I will stick with the notion that the current spec wording is correct, and that read errors CANNOT be gracefully recovered from unless BOTH sides transfer (possibly bogus) bytes along with the error message, and which is why BOTH sides of the protocol are warned that read errors usually result in a disconnection rather than clean continuation, without the addition of STRUCTURED_READ. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature