From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDY6Z-0007CA-73 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:17:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDY6U-00038V-4I for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:17:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDY6T-00038R-Uh for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:17:06 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D3BBCF604 for ; Thu, 16 Jun 2016 14:17:05 +0000 (UTC) From: Paolo Bonzini Date: Thu, 16 Jun 2016 16:16:19 +0200 Message-Id: <1466086585-16526-25-git-send-email-pbonzini@redhat.com> In-Reply-To: <1466086585-16526-1-git-send-email-pbonzini@redhat.com> References: <1466086585-16526-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 24/30] nbd: Detect servers that send unexpected error values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Eric Blake Add some debugging to flag servers that are not compliant to the NBD protocol. This would have flagged the server bug fixed in commit c0301fcc. Signed-off-by: Eric Blake Reviewed-by: Alex Bligh Message-Id: <1463006384-7734-11-git-send-email-eblake@redhat.com> Signed-off-by: Paolo Bonzini --- nbd/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nbd/client.c b/nbd/client.c index 20e6daf..e8bf9fb 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -33,8 +33,10 @@ static int nbd_errno_to_system_errno(int err) return ENOMEM; case NBD_ENOSPC: return ENOSPC; - case NBD_EINVAL: default: + TRACE("Squashing unexpected error %d to EINVAL", err); + /* fallthrough */ + case NBD_EINVAL: return EINVAL; } } -- 2.5.5