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

Re: [Nbd] [PATCH] define error values as part of the protocol



Hi Paolo,

Yes, this is something that I had been thinking about for a while
myself; the only reason why I didn't fix this yet was that I needed to
make a proper inventory of (useful) error codes that could be returned.
Thanks for doing so ;-)

On Thu, May 07, 2015 at 05:58:12PM +0200, Paolo Bonzini wrote:
> Right now, NBD includes potentially platform-specific error values in
> the protocol.
> 
> Luckily, most common error values are more or less universal: of all
> errno values <= 34 (up to ERANGE), only 11 seems to differ across the
> common platforms: it is EAGAIN on Windows and Linux, but it is EDEADLK
> on Darwin and the *BSDs.
> 
> This patch defines a limited set of errno values that are valid for the
> NBD protocol, and specifies recommendations for what error to return
> in specific corner cases.  The set of errno values is roughly based on
> the errors listed in the read(2) and write(2) man pages, with some
> exception:
> 
> - ENOMEM is added for servers that implement copy-on-write or other
>   formats that require dynamic allocation.

Hrm. ENOMEM can also happen if a buffer-using server gets a very large
request. The kind of ENOMEM you're suggesting above should probably be a
fatal error; a "request too large" type of error should not be. I'd like
to be able to make that distinction in the protocol.

Also, we should indeed stick to errno numbers for backwards
compatibility, but there's no reason why we wouldn't be able to create a
separate set of numbers (with a high bit set, e.g.) for errors that
can't be properly expressed with errno numbers, and I'm not sure if
mapping ENOMEM in this manner is a good idea.

As to whether ENOMEM should be a fatal message in the protocol or not?
Not sure.

Thoughts?

> - EDQUOT is not part of the universal set of errors; it can be changed
>   to ENOSPC on the wire format.
> 
> - EFBIG is part of the universal set of errors, but it is also changed
>   to ENOSPC because it is pretty similar to ENOSPC or EDQUOT.

Yeah, that makes sense.

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

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



Reply to: