qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] nbd structured reply


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] nbd structured reply
Date: Fri, 22 Sep 2017 17:57:07 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

21.09.2017 16:55, Eric Blake wrote:
[updating CC to point to the correct new NBD list]

On 09/21/2017 07:18 AM, Vladimir Sementsov-Ogievskiy wrote:
Hi all!

I'm about this:

"A server SHOULD try to minimize the number of chunks sent in a reply,
but MUST NOT mark a chunk as final if there is still a possibility of
detecting an error before transmission of that chunk completes"

What do we mean by "possibility"? Formally, such possibility exists
always, so, we'll never mark a chunk as final.
Here's what is envisioned.  It is fairly easy to write a server that
receives an NBD_CMD_READ, issues the header reply, and only then
dispatches the I/O to collect the data from the file system to send
after the header.  But if you encounter EIO (or other problem) while
reading from the file system, you're stuck if you've already sent the
header.  In this scenario, if you mark the header being as final, you
are unable to report the EIO (it is one of the flaws with non-structured
reads that makes the spec say that if you detect an error after sending
the header, you have no choice but to terminate the connection).

An alternative server implementation would buffer the header, perform
the I/O to collect data from the file system, and only when it is all
present in memory, it finally sends the reply to the client.  In this
scenario, since you wait until all data is buffered, you know up front
whether an error occurred while collecting the I/O, and can therefore
send the data as the final packet right away (whether error or success).
  However, it potentially requires more memory to buffer requests like
this, compared to the server that sends information piecemeal as soon as
it obtains data.

The intent is not to detect errors in sending the data over the wire,
but in detecting errors in reading the data from the underlying storage
(or however else the data to be read is being collected).  A chunk must
not be marked final unless you can guarantee that there will be no
further errors in collecting data for the reply.

If you have suggestions for improving the NBD spec wording, feel free to
propose a doc patch.


Thanks, now I understand.. However I don't have good idea of wording..


Another thing: server can send several error and success chunks on CMD_READ..

The obvious behavior of client is to fail the whole read if it received one error chunk. And, actually, client is not interesting in all following chunks for this request. I think we need some additional negotiation flag for this, which says that error chunk
must be final.

May be we need also a method (command) to cancel one of inflight requests, but it
is not so important.


--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]