From patchwork Mon Sep 24 13:33:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1497631 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 75CDD40B1E for ; Mon, 24 Sep 2012 13:33:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755358Ab2IXNdt (ORCPT ); Mon, 24 Sep 2012 09:33:49 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:38999 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755341Ab2IXNdr (ORCPT ); Mon, 24 Sep 2012 09:33:47 -0400 Received: by ghbg15 with SMTP id g15so1636934ghb.19 for ; Mon, 24 Sep 2012 06:33:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=L+fabSNaSJlgqEIz/Aqfxt+cg25uCcp9ENMrL8Uf+qw=; b=Tl006Jez7m4Oxs+i0Qpn4YUxhaE62PJOpvStBIr2GFtS7zZnqw6Jl+y1letcXsph6K Vy9XWkgPA9sePeC6XiwkmumDNLeS4HGxXMffP/3pZZ9Z3NQ20cN0TxFxCj1nPs55quFv 0kczjsCJi/PnoV/CNS69e4zQfJBzhVxpsB00+2RYtRbtcOwxv7BpDoKad2pW/NIEFmRd s7bu15EtyM1Ti8bg85T+tsAxT3+ATfn8ci95/4tepk1sHUa0YD12C8RTEhLulekuSZ+I ogjW8XQ1dXVOarJeRGc3e8Sji4XODtw8WnBZSj9V7rSayP8/AuyQOfuRIB0s1zq9bHeK 2GYA== Received: by 10.236.153.164 with SMTP id f24mr11933607yhk.83.1348493626929; Mon, 24 Sep 2012 06:33:46 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-069-134-145-027.nc.res.rr.com. [69.134.145.27]) by mx.google.com with ESMTPS id h27sm24809912yhk.10.2012.09.24.06.33.45 (version=SSLv3 cipher=OTHER); Mon, 24 Sep 2012 06:33:46 -0700 (PDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH] cifs: change DOS/NT/POSIX mapping of ERRnoresource Date: Mon, 24 Sep 2012 09:33:40 -0400 Message-Id: <1348493620-1887-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.4 X-Gm-Message-State: ALoCoQkTJG23V6TT3ld7Fi+3zfR8AIkM4bUhCIYRFM+O0gP/+0SpX+8QOpF903n3+IkSIi3/qzG3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org ERRnoresource is an ERRSRV level (aka server-side) error and means "No resources currently available for request". Currently that maps to POSIX -ENOBUFS. No NT errors map to it currently. NT_STATUS_INSUFFICIENT_RESOURCES and NT_STATUS_INSUFF_SERVER_RESOURCES are also similar in meaning. Currently the client maps those to ERRnomem, which maps to -ENOMEM in POSIX. All of these mappings seem to be quite wrong to me and are confusing for users. All of the above errors indicate problems on the server, not the client. Reporting -ENOMEM or -ENOBUFS implies that the client is running out of resources. This patch changes those mappings. The NT_* errors are changed to map to the SRV level ERRnoresource. That error is in turn changed to return -EREMOTEIO which is the only POSIX error I could find that conveys that something went wrong on the server. While we're at it, change the SMB2 equivalent error to return the same. Signed-off-by: Jeff Layton Acked-by: Suresh Jayaraman --- fs/cifs/netmisc.c | 6 +++--- fs/cifs/smb2maperror.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index e7bab3b..d5ce9e2 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -110,7 +110,7 @@ static const struct smb_to_posix_error mapping_table_ERRSRV[] = { {ERRnoroom, -ENOSPC}, {ERRrmuns, -EUSERS}, {ERRtimeout, -ETIME}, - {ERRnoresource, -ENOBUFS}, + {ERRnoresource, -EREMOTEIO}, {ERRtoomanyuids, -EUSERS}, {ERRbaduid, -EACCES}, {ERRusempx, -EIO}, @@ -412,7 +412,7 @@ static const struct { from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */ { - ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, { + ERRDOS, ERRnoresource, NT_STATUS_INSUFFICIENT_RESOURCES}, { ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { ERRDOS, 23, NT_STATUS_DEVICE_DATA_ERROR}, { ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, { @@ -682,7 +682,7 @@ static const struct { ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, { ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, { ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, { - ERRDOS, ERRnomem, NT_STATUS_INSUFF_SERVER_RESOURCES}, { + ERRDOS, ERRnoresource, NT_STATUS_INSUFF_SERVER_RESOURCES}, { ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, { ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, { ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, { diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c index eaf5466..494c912 100644 --- a/fs/cifs/smb2maperror.c +++ b/fs/cifs/smb2maperror.c @@ -453,7 +453,8 @@ static const struct status_to_posix_error smb2_error_map_table[] = { {STATUS_FILE_INVALID, -EIO, "STATUS_FILE_INVALID"}, {STATUS_ALLOTTED_SPACE_EXCEEDED, -EIO, "STATUS_ALLOTTED_SPACE_EXCEEDED"}, - {STATUS_INSUFFICIENT_RESOURCES, -EIO, "STATUS_INSUFFICIENT_RESOURCES"}, + {STATUS_INSUFFICIENT_RESOURCES, -EREMOTEIO, + "STATUS_INSUFFICIENT_RESOURCES"}, {STATUS_DFS_EXIT_PATH_FOUND, -EIO, "STATUS_DFS_EXIT_PATH_FOUND"}, {STATUS_DEVICE_DATA_ERROR, -EIO, "STATUS_DEVICE_DATA_ERROR"}, {STATUS_DEVICE_NOT_CONNECTED, -EIO, "STATUS_DEVICE_NOT_CONNECTED"},