From patchwork Wed Mar 27 19:03:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Zentai X-Patchwork-Id: 10873895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92AB0139A for ; Wed, 27 Mar 2019 19:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D14F28C9D for ; Wed, 27 Mar 2019 19:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7178028C1E; Wed, 27 Mar 2019 19:11:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5890E28CE1 for ; Wed, 27 Mar 2019 19:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389001AbfC0TLW convert rfc822-to-8bit (ORCPT ); Wed, 27 Mar 2019 15:11:22 -0400 Received: from 193-32-235-38.hosts.ezit.hu ([193.32.235.38]:35208 "EHLO zentai.name" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S2388428AbfC0TLV (ORCPT ); Wed, 27 Mar 2019 15:11:21 -0400 X-Greylist: delayed 454 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Mar 2019 15:11:20 EDT From: Armin Zentai Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [PATCH] Add EMFILE to nfsd errors Message-Id: <23B588B3-C119-4036-B60B-7872A52129F4@zentai.name> Date: Wed, 27 Mar 2019 20:03:43 +0100 To: linux-nfs@vger.kernel.org, "J. Bruce Fields" , Jeff Layton Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the EMFILE to nfsd errors for better error output. I've encountered a hard-to-debug situation, when I used a fuse under an NFS export, because of a 'too many open files' error. Before the patch nfsd warns with this message: 'nfsd4_process_open2 failed to open newly-created file! status=5' (5: EIO) After the patch: 'nfsd4_process_open2 failed to open newly-created file! status=24' (24: EMFILE) Also the client returns with EREMOTEIO instead of EIO, which indicates a server error from the NFS client side. Signed-off-by: Armin ZENTAI --- fs/nfsd/nfsd.h | 1 + fs/nfsd/nfsproc.c | 1 + include/uapi/linux/nfs.h | 1 + 3 files changed, 3 insertions(+) -- 2.11.0 diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 066899929863..19a269d75fb5 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -217,6 +217,7 @@ void nfsd_lockd_shutdown(void); #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN) #define nfserr_locked cpu_to_be32(NFSERR_LOCKED) #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC) +#define nfserr_emfile cpu_to_be32(NFSERR_EMFILE) #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE) #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT) #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST) diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 0d20fd161225..ff9e883c7829 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -810,6 +810,7 @@ nfserrno (int errno) { nfserr_serverfault, -ENFILE }, { nfserr_io, -EUCLEAN }, { nfserr_perm, -ENOKEY }, + { nfserr_emfile, -EMFILE }, }; int i; diff --git a/include/uapi/linux/nfs.h b/include/uapi/linux/nfs.h index 946cb62d64b0..dcb0ea33f2db 100644 --- a/include/uapi/linux/nfs.h +++ b/include/uapi/linux/nfs.h @@ -57,6 +57,7 @@ NFSERR_NOTDIR = 20, /* v2 v3 v4 */ NFSERR_ISDIR = 21, /* v2 v3 v4 */ NFSERR_INVAL = 22, /* v2 v3 v4 */ + NFSERR_EMFILE = 24, /* v2 v3 v4 */ NFSERR_FBIG = 27, /* v2 v3 v4 */ NFSERR_NOSPC = 28, /* v2 v3 v4 */ NFSERR_ROFS = 30, /* v2 v3 v4 */