Skip to content

Commit ef7f6c4

Browse files
neilbrownchucklever
authored andcommitted
nfsd: move V4ROOT version check to nfsd_set_fh_dentry()
This further centralizes version number checks. Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent c689bdd commit ef7f6c4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

fs/nfsd/nfsfh.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,11 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
116116
return nfserrno(nfsd_setuser(&rqstp->rq_cred, exp));
117117
}
118118

119-
static inline __be32 check_pseudo_root(struct svc_rqst *rqstp,
120-
struct dentry *dentry, struct svc_export *exp)
119+
static inline __be32 check_pseudo_root(struct dentry *dentry,
120+
struct svc_export *exp)
121121
{
122122
if (!(exp->ex_flags & NFSEXP_V4ROOT))
123123
return nfs_ok;
124-
/*
125-
* v2/v3 clients have no need for the V4ROOT export--they use
126-
* the mount protocl instead; also, further V4ROOT checks may be
127-
* in v4-specific code, in which case v2/v3 clients could bypass
128-
* them.
129-
*/
130-
if (!nfsd_v4client(rqstp))
131-
return nfserr_stale;
132124
/*
133125
* We're exposing only the directories and symlinks that have to be
134126
* traversed on the way to real exports:
@@ -290,11 +282,15 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
290282
if (dentry->d_sb->s_export_op->flags & EXPORT_OP_NOWCC)
291283
fhp->fh_no_wcc = true;
292284
fhp->fh_64bit_cookies = true;
285+
if (exp->ex_flags & NFSEXP_V4ROOT)
286+
goto out;
293287
break;
294288
case 2:
295289
fhp->fh_no_wcc = true;
296290
if (EX_WGATHER(exp))
297291
fhp->fh_use_wgather = true;
292+
if (exp->ex_flags & NFSEXP_V4ROOT)
293+
goto out;
298294
}
299295

300296
return 0;
@@ -364,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
364360
* (for example, if different id-squashing options are in
365361
* effect on the new filesystem).
366362
*/
367-
error = check_pseudo_root(rqstp, dentry, exp);
363+
error = check_pseudo_root(dentry, exp);
368364
if (error)
369365
goto out;
370366

0 commit comments

Comments
 (0)