Hi,

I've been working on a way to reimplement the core of nbd-server, in the
io_transaction branch. It's not moving along very fast, but steadily so.

Today, I was rethinking things a bit again, and came to the conclusion
that there's a problem in the error messaging from server to client in
case of a read error.

The protocol currently wants the server to send the reply header before
the data. If there's any error, the error should be signalled through
the error field in the reply header.

This implies that the server must read the full data from disk to memory
before sending anything to the client. If it were to use sendfile() or
similar things that don't use a memory buffer and an error occurred
while reading from disk, then the reply header will already have been
sent and there's nothing the server can do anymore to signal this
problem.

This could be fixed, after proper negotiation, by sticking a second
reply header after read requests in which the server can signal error
messages. The sequence of data sent from server to client on a read
request would then look as follows:

reply header -- if the request contained any error (i.e., request was
                out of bounds for the client), then the error field is
                set here and no data is sent.
data -- if any error occurred while reading from the disk, data is
                padded with zeroes.
2nd reply header -- if an error occured while reading from disk, the
                error field is set here.

This would be an incompatible change, so it should only be enabled if
the client signalled that it supports this.

Thoughts?

-- 
It is easy to love a country that is famous for chocolate and beer

  -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to