Skip to content

Commit 7c0b07b

Browse files
chuckleverAnna Schumaker
authored andcommitted
NFSD: Avoid using rqstp->rq_vers in nfsd_set_fh_dentry()
Currently, fh_verify() makes some daring assumptions about which version of file handle the caller wants, based on the things it can find in the passed-in rqstp. The about-to-be-introduced LOCALIO use case sometimes has no svc_rqst context, so this logic won't work in that case. Instead, examine the passed-in file handle. It's .max_size field should carry information to allow nfsd_set_fh_dentry() to initialize the file handle appropriately. The file handle used by lockd and the one created by write_filehandle never need any of the version-specific fields (which affect things like write and getattr requests and pre/post attributes). Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: NeilBrown <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent b0d87db commit 7c0b07b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/nfsd/nfsfh.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,20 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
267267
fhp->fh_dentry = dentry;
268268
fhp->fh_export = exp;
269269

270-
switch (rqstp->rq_vers) {
271-
case 4:
270+
switch (fhp->fh_maxsize) {
271+
case NFS4_FHSIZE:
272272
if (dentry->d_sb->s_export_op->flags & EXPORT_OP_NOATOMIC_ATTR)
273273
fhp->fh_no_atomic_attr = true;
274274
fhp->fh_64bit_cookies = true;
275275
break;
276-
case 3:
276+
case NFS3_FHSIZE:
277277
if (dentry->d_sb->s_export_op->flags & EXPORT_OP_NOWCC)
278278
fhp->fh_no_wcc = true;
279279
fhp->fh_64bit_cookies = true;
280280
if (exp->ex_flags & NFSEXP_V4ROOT)
281281
goto out;
282282
break;
283-
case 2:
283+
case NFS_FHSIZE:
284284
fhp->fh_no_wcc = true;
285285
if (EX_WGATHER(exp))
286286
fhp->fh_use_wgather = true;

0 commit comments

Comments
 (0)