From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqfVn-0003gM-P6 for qemu-devel@nongnu.org; Fri, 08 May 2015 06:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqfVk-0003T5-Gp for qemu-devel@nongnu.org; Fri, 08 May 2015 06:28:07 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:35267) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqfVk-0003Ss-AG for qemu-devel@nongnu.org; Fri, 08 May 2015 06:28:04 -0400 Received: by wgyo15 with SMTP id o15so68409286wgy.2 for ; Fri, 08 May 2015 03:28:03 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <554C8FAF.1080207@redhat.com> Date: Fri, 08 May 2015 12:27:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1431078628-7856-1-git-send-email-pbonzini@redhat.com> <87zj5ffkea.fsf@blackfin.pond.sub.org> In-Reply-To: <87zj5ffkea.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2] qemu-nbd: only send a limited number of errno codes on the wire List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, "Richard W.M. Jones" , qemu-devel@nongnu.org, mreitz@redhat.com 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