Skip to content

Commit 9e91edc

Browse files
committed
Merge branch 'for-4.2' of git://linux-nfs.org/~bfields/linux
Pull nfsd fixes from Bruce Fields. * 'for-4.2' of git://linux-nfs.org/~bfields/linux: nfsd: do nfs4_check_fh in nfs4_check_file instead of nfs4_check_olstateid nfsd: Fix a file leak on nfsd4_layout_setlease failure nfsd: Drop BUG_ON and ignore SECLABEL on absent filesystem
2 parents ecf5fc6 + 8fcd461 commit 9e91edc

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

fs/nfsd/nfs4layouts.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate,
212212
BUG_ON(!ls->ls_file);
213213

214214
if (nfsd4_layout_setlease(ls)) {
215+
fput(ls->ls_file);
215216
put_nfs4_file(fp);
216217
kmem_cache_free(nfs4_layout_stateid_cache, ls);
217218
return NULL;

fs/nfsd/nfs4state.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4396,9 +4396,9 @@ laundromat_main(struct work_struct *laundry)
43964396
queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ);
43974397
}
43984398

4399-
static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp)
4399+
static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp)
44004400
{
4401-
if (!fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle))
4401+
if (!fh_match(&fhp->fh_handle, &stp->sc_file->fi_fhandle))
44024402
return nfserr_bad_stateid;
44034403
return nfs_ok;
44044404
}
@@ -4601,9 +4601,6 @@ nfs4_check_olstateid(struct svc_fh *fhp, struct nfs4_ol_stateid *ols, int flags)
46014601
{
46024602
__be32 status;
46034603

4604-
status = nfs4_check_fh(fhp, ols);
4605-
if (status)
4606-
return status;
46074604
status = nfsd4_check_openowner_confirmed(ols);
46084605
if (status)
46094606
return status;
@@ -4690,6 +4687,9 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp,
46904687
status = nfserr_bad_stateid;
46914688
break;
46924689
}
4690+
if (status)
4691+
goto out;
4692+
status = nfs4_check_fh(fhp, s);
46934693

46944694
done:
46954695
if (!status && filpp)
@@ -4798,7 +4798,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_
47984798
status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
47994799
if (status)
48004800
return status;
4801-
return nfs4_check_fh(current_fh, stp);
4801+
return nfs4_check_fh(current_fh, &stp->st_stid);
48024802
}
48034803

48044804
/*

fs/nfsd/nfs4xdr.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,7 @@ nfsd4_encode_aclname(struct xdr_stream *xdr, struct svc_rqst *rqstp,
21432143
#define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \
21442144
FATTR4_WORD0_RDATTR_ERROR)
21452145
#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
2146+
#define WORD2_ABSENT_FS_ATTRS 0
21462147

21472148
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
21482149
static inline __be32
@@ -2171,7 +2172,7 @@ nfsd4_encode_security_label(struct xdr_stream *xdr, struct svc_rqst *rqstp,
21712172
{ return 0; }
21722173
#endif
21732174

2174-
static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
2175+
static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32 *rdattr_err)
21752176
{
21762177
/* As per referral draft: */
21772178
if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS ||
@@ -2184,6 +2185,7 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
21842185
}
21852186
*bmval0 &= WORD0_ABSENT_FS_ATTRS;
21862187
*bmval1 &= WORD1_ABSENT_FS_ATTRS;
2188+
*bmval2 &= WORD2_ABSENT_FS_ATTRS;
21872189
return 0;
21882190
}
21892191

@@ -2246,8 +2248,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
22462248
BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion));
22472249

22482250
if (exp->ex_fslocs.migrated) {
2249-
BUG_ON(bmval[2]);
2250-
status = fattr_handle_absent_fs(&bmval0, &bmval1, &rdattr_err);
2251+
status = fattr_handle_absent_fs(&bmval0, &bmval1, &bmval2, &rdattr_err);
22512252
if (status)
22522253
goto out;
22532254
}
@@ -2286,8 +2287,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
22862287
}
22872288

22882289
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2289-
if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) ||
2290-
bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) {
2290+
if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL) ||
2291+
bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) {
22912292
err = security_inode_getsecctx(d_inode(dentry),
22922293
&context, &contextlen);
22932294
contextsupport = (err == 0);

0 commit comments

Comments
 (0)