linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: "J. Bruce Fields" <bfields@redhat.com>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 5/6] nfsd: Fix up nfsd to ensure that timeout errors don't result in ESTALE
Date: Mon, 30 Nov 2020 16:24:54 -0500	[thread overview]
Message-ID: <20201130212455.254469-6-trondmy@kernel.org> (raw)
In-Reply-To: <20201130212455.254469-5-trondmy@kernel.org>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

If the underlying filesystem times out, then we want knfsd to return
NFSERR_JUKEBOX/DELAY rather than NFSERR_STALE.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfsd/nfsfh.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 0c2ee65e46f3..46c86f7bc429 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -268,12 +268,20 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
 	if (fileid_type == FILEID_ROOT)
 		dentry = dget(exp->ex_path.dentry);
 	else {
-		dentry = exportfs_decode_fh(exp->ex_path.mnt, fid,
-				data_left, fileid_type,
-				nfsd_acceptable, exp);
-		if (IS_ERR_OR_NULL(dentry))
+		dentry = exportfs_decode_fh_raw(exp->ex_path.mnt, fid,
+						data_left, fileid_type,
+						nfsd_acceptable, exp);
+		if (IS_ERR_OR_NULL(dentry)) {
 			trace_nfsd_set_fh_dentry_badhandle(rqstp, fhp,
 					dentry ?  PTR_ERR(dentry) : -ESTALE);
+			switch (PTR_ERR(dentry)) {
+			case -ENOMEM:
+			case -ETIMEDOUT:
+				break;
+			default:
+				dentry = ERR_PTR(-ESTALE);
+			}
+		}
 	}
 	if (dentry == NULL)
 		goto out;
-- 
2.28.0


  reply	other threads:[~2020-11-30 21:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 21:24 [PATCH 0/6] Patches to support NFS re-exporting trondmy
2020-11-30 21:24 ` [PATCH 1/6] nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations trondmy
2020-11-30 21:24   ` [PATCH 2/6] nfsd: allow filesystems to opt out of subtree checking trondmy
2020-11-30 21:24     ` [PATCH 3/6] nfsd: close cached files prior to a REMOVE or RENAME that would replace target trondmy
2020-11-30 21:24       ` [PATCH 4/6] exportfs: Add a function to return the raw output from fh_to_dentry() trondmy
2020-11-30 21:24         ` trondmy [this message]
2020-11-30 21:24           ` [PATCH 6/6] nfsd: Set PF_LOCAL_THROTTLE on local filesystems only trondmy
2020-11-30 23:05           ` [PATCH 5/6] nfsd: Fix up nfsd to ensure that timeout errors don't result in ESTALE J. Bruce Fields
2020-12-01  0:39             ` Trond Myklebust
2020-12-01  2:30               ` J. Bruce Fields
2020-11-30 22:59     ` [PATCH 2/6] nfsd: allow filesystems to opt out of subtree checking J. Bruce Fields
2020-11-30 22:58   ` [PATCH 1/6] nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations J. Bruce Fields
2020-12-01  0:33     ` Trond Myklebust
2020-12-01  0:45     ` Trond Myklebust
2020-12-01  2:28       ` J. Bruce Fields
2020-12-01  3:06         ` Trond Myklebust
2020-12-01  3:11           ` bfields
2020-12-01  3:16             ` Trond Myklebust
2020-12-01  3:23               ` Trond Myklebust
2020-12-01 15:19                 ` bfields
2020-12-01 15:50                   ` Trond Myklebust
2020-12-01 15:06               ` J. Bruce Fields
2020-12-01 19:46     ` J. Bruce Fields
2020-11-30 23:11   ` Chuck Lever
2020-12-01  0:49     ` Trond Myklebust
2020-12-01  0:14   ` Jeff Layton
2020-11-30 21:40 ` [PATCH 0/6] Patches to support NFS re-exporting Chuck Lever
2020-11-30 21:51   ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201130212455.254469-6-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --cc=bfields@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).