Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297457
b: refs/heads/master
c: 999448a
h: refs/heads/master
i:
  297455: 480224c
v: v3
  • Loading branch information
Bernd Schubert authored and Theodore Ts'o committed Mar 19, 2012
1 parent 216d194 commit b9a6a7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1f5273e9adb40724a85272f248f210dc4ce919a
refs/heads/master: 999448a8c0202d8c41711c92385323520644527b
18 changes: 10 additions & 8 deletions trunk/fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,13 @@ static int nfsd_open_break_lease(struct inode *inode, int access)

/*
* Open an existing file or directory.
* The access argument indicates the type of open (read/write/lock)
* The may_flags argument indicates the type of open (read/write/lock)
* and additional flags.
* N.B. After this call fhp needs an fh_put
*/
__be32
nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
int access, struct file **filp)
int may_flags, struct file **filp)
{
struct dentry *dentry;
struct inode *inode;
Expand All @@ -757,7 +758,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
* and (hopefully) checked permission - so allow OWNER_OVERRIDE
* in case a chmod has now revoked permission.
*/
err = fh_verify(rqstp, fhp, type, access | NFSD_MAY_OWNER_OVERRIDE);
err = fh_verify(rqstp, fhp, type, may_flags | NFSD_MAY_OWNER_OVERRIDE);
if (err)
goto out;

Expand All @@ -768,7 +769,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
* or any access when mandatory locking enabled
*/
err = nfserr_perm;
if (IS_APPEND(inode) && (access & NFSD_MAY_WRITE))
if (IS_APPEND(inode) && (may_flags & NFSD_MAY_WRITE))
goto out;
/*
* We must ignore files (but only files) which might have mandatory
Expand All @@ -781,12 +782,12 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
if (!inode->i_fop)
goto out;

host_err = nfsd_open_break_lease(inode, access);
host_err = nfsd_open_break_lease(inode, may_flags);
if (host_err) /* NOMEM or WOULDBLOCK */
goto out_nfserr;

if (access & NFSD_MAY_WRITE) {
if (access & NFSD_MAY_READ)
if (may_flags & NFSD_MAY_WRITE) {
if (may_flags & NFSD_MAY_READ)
flags = O_RDWR|O_LARGEFILE;
else
flags = O_WRONLY|O_LARGEFILE;
Expand All @@ -796,7 +797,8 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
if (IS_ERR(*filp))
host_err = PTR_ERR(*filp);
else
host_err = ima_file_check(*filp, access);
host_err = ima_file_check(*filp, may_flags);

out_nfserr:
err = nfserrno(host_err);
out:
Expand Down

0 comments on commit b9a6a7e

Please sign in to comment.