NFSD: Clean up nfsd_open_verified()

[ Upstream commit f4d84c52643ae1d63a8e73e2585464470e7944d1 ]

Its only caller always passes S_IFREG as the @type parameter. As an
additional clean-up, add a kerneldoc comment.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Chuck Lever
2022-03-27 16:46:47 -04:00
committed by Greg Kroah-Hartman
parent 274fd0f9c2
commit d8714bda3f
3 changed files with 15 additions and 6 deletions

View File

@@ -996,8 +996,8 @@ open_file:
nf->nf_mark = nfsd_file_mark_find_or_create(nf); nf->nf_mark = nfsd_file_mark_find_or_create(nf);
if (nf->nf_mark) if (nf->nf_mark)
status = nfsd_open_verified(rqstp, fhp, S_IFREG, status = nfsd_open_verified(rqstp, fhp, may_flags,
may_flags, &nf->nf_file); &nf->nf_file);
else else
status = nfserr_jukebox; status = nfserr_jukebox;
/* /*

View File

@@ -852,14 +852,23 @@ retry:
return err; return err;
} }
/**
* nfsd_open_verified - Open a regular file for the filecache
* @rqstp: RPC request
* @fhp: NFS filehandle of the file to open
* @may_flags: internal permission flags
* @filp: OUT: open "struct file *"
*
* Returns an nfsstat value in network byte order.
*/
__be32 __be32
nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, int may_flags,
int may_flags, struct file **filp) struct file **filp)
{ {
__be32 err; __be32 err;
validate_process_creds(); validate_process_creds();
err = __nfsd_open(rqstp, fhp, type, may_flags, filp); err = __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp);
validate_process_creds(); validate_process_creds();
return err; return err;
} }

View File

@@ -86,7 +86,7 @@ __be32 nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
int nfsd_open_break_lease(struct inode *, int); int nfsd_open_break_lease(struct inode *, int);
__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t, __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t,
int, struct file **); int, struct file **);
__be32 nfsd_open_verified(struct svc_rqst *, struct svc_fh *, umode_t, __be32 nfsd_open_verified(struct svc_rqst *, struct svc_fh *,
int, struct file **); int, struct file **);
__be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
struct file *file, loff_t offset, struct file *file, loff_t offset,