Merge branch 'for-2.6.39' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.39' of git://linux-nfs.org/~bfields/linux: Open with O_CREAT flag set fails to open existing files on non writable directories nfsd4: Fix filp leak nfsd4: fix struct file leak on delegation
This commit is contained in:
commit
18995ba5ab
2 changed files with 10 additions and 2 deletions
|
@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
|
|||
if (atomic_dec_and_test(&fp->fi_delegees)) {
|
||||
vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
|
||||
fp->fi_lease = NULL;
|
||||
fput(fp->fi_deleg_file);
|
||||
fp->fi_deleg_file = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -402,8 +403,8 @@ static void free_generic_stateid(struct nfs4_stateid *stp)
|
|||
if (stp->st_access_bmap) {
|
||||
oflag = nfs4_access_bmap_to_omode(stp);
|
||||
nfs4_file_put_access(stp->st_file, oflag);
|
||||
put_nfs4_file(stp->st_file);
|
||||
}
|
||||
put_nfs4_file(stp->st_file);
|
||||
kmem_cache_free(stateid_slab, stp);
|
||||
}
|
||||
|
||||
|
|
|
@ -1363,7 +1363,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|||
goto out;
|
||||
if (!(iap->ia_valid & ATTR_MODE))
|
||||
iap->ia_mode = 0;
|
||||
err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
|
||||
err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
|
@ -1385,6 +1385,13 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|||
if (IS_ERR(dchild))
|
||||
goto out_nfserr;
|
||||
|
||||
/* If file doesn't exist, check for permissions to create one */
|
||||
if (!dchild->d_inode) {
|
||||
err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
|
||||
if (err)
|
||||
goto out;
|
||||
|
|
Loading…
Reference in a new issue