From: NeilBrown There is no longer any value in having nfsd_check_obj_isreg() return over-loaded error codes which are converted to nfs error codes. So revert to directly returning the required nfs error code. Also take the opportunity to avoid dereferencing the inode and determine the type directly from the dentry. Signed-off-by: NeilBrown --- fs/nfsd/nfs4proc.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 50baf125d5f9..40bd1179bf60 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -223,17 +223,15 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs return fh_verify(rqstp, current_fh, S_IFREG, accmode); } -static int nfsd_check_obj_isreg(struct dentry *child) +static __be32 nfsd_check_obj_isreg(struct dentry *child) { - umode_t mode = d_inode(child)->i_mode; - - if (S_ISREG(mode)) + if (d_is_reg(child)) return 0; - if (S_ISDIR(mode)) - return -EISDIR; - if (S_ISLNK(mode)) - return -ELOOP; - return -EFTYPE; + if (d_is_dir(child)) + return nfserr_isdir; + if (d_is_symlink(child)) + return nfserr_symlink; + return nfserr_wrong_type; } static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh) @@ -565,7 +563,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, stru } if (status) goto out; - status = nfserrno(nfsd_check_obj_isreg((*resfh)->fh_dentry)); + status = nfsd_check_obj_isreg((*resfh)->fh_dentry); if (status) goto out; -- 2.50.0.107.gf914562f5916.dirty