qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] qemu-nbd: only send a limited number of errn


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2] qemu-nbd: only send a limited number of errno codes on the wire
Date: Fri, 08 May 2015 12:27:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 08/05/2015 12:12, Markus Armbruster wrote:
>> The corresponding patch to the NBD protocol description can be found at
>> http://article.gmane.org/gmane.linux.drivers.nbd.general/3154.

[...]

>> - 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.
> 
> Perhaps debatable, but I defer to your judgement.

EFBIG is weird anyway, and requires you (or your parents) to ignore
SIGXFSZ.  A simpler protocol puts fewer requirements on the client.

(In fact, we probably should ignore SIGXFSZ in QEMU and treat EFBIG like
ENOSPC everywhere.  Should doesn't mean that it will get on anyone's
todo list or priority list...).

>> +static int nbd_errno_to_system_errno(int err)
>> +{
>> +    switch (err) {
>> +    case NBD_EPERM:
>> +        return EPERM;
>> +    case NBD_EIO:
>> +        return EIO;
>> +    case NBD_ENOMEM:
>> +        return ENOMEM;
>> +    case NBD_ENOSPC:
>> +        return ENOSPC;
>> +    case NBD_EINVAL:
>> +    default:
>> +        return EINVAL;
>> +    }
>> +}
>> +
> 
> If we reach default, something's amiss, isn't it?  Worth logging
> something then?

Not necessarily.  You could have an older NBD server on the other side,
and then the errno code might only be valid on another platform!

In fact, if the NBD server is qemu-nbd, the producer of the error could
be any driver in block/ for any old version of QEMU.  I would not be
surprised if an EPIPE or ENOTCONN sneaked in somehow.

And there are probably other NBD servers around.  CCing Rich Jones so
that he can fix nbdkit.

Paolo



reply via email to

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