diff mbox series

[v3,14/15] NFSD: Map nfserr_wrongsec outside of nfsd_dispatch

Message ID 160159319999.79253.17056285986114769297.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series nfsd_dispatch() clean up | expand

Commit Message

Chuck Lever III Oct. 1, 2020, 11 p.m. UTC
Refactor: Handle this NFS version-specific mapping in the only
place where nfserr_wrongsec is generated.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/export.c |    2 +-
 fs/nfsd/nfssvc.c |    2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index cb777fe82988..21e404e7cb68 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1002,7 +1002,7 @@  __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp)
 	if (nfsd4_spo_must_allow(rqstp))
 		return 0;
 
-	return nfserr_wrongsec;
+	return rqstp->rq_vers < 4 ? nfserr_acces : nfserr_wrongsec;
 }
 
 /*
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 4aa8db879ca2..beb3875241cb 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -964,8 +964,6 @@  static __be32 map_new_errors(u32 vers, __be32 nfserr)
 {
 	if (nfserr == nfserr_jukebox && vers == 2)
 		return nfserr_dropit;
-	if (nfserr == nfserr_wrongsec && vers < 4)
-		return nfserr_acces;
 	return nfserr;
 }