diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 5d864fb36578..cf747ef86650 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1626,7 +1626,8 @@ static int _nfs4_recover_proc_open(struct nfs4_opendata *data) | |||
1626 | 1626 | ||
1627 | static int nfs4_opendata_access(struct rpc_cred *cred, | 1627 | static int nfs4_opendata_access(struct rpc_cred *cred, |
1628 | struct nfs4_opendata *opendata, | 1628 | struct nfs4_opendata *opendata, |
1629 | struct nfs4_state *state, fmode_t fmode) | 1629 | struct nfs4_state *state, fmode_t fmode, |
1630 | int openflags) | ||
1630 | { | 1631 | { |
1631 | struct nfs_access_entry cache; | 1632 | struct nfs_access_entry cache; |
1632 | u32 mask; | 1633 | u32 mask; |
@@ -1638,11 +1639,14 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
1638 | 1639 | ||
1639 | mask = 0; | 1640 | mask = 0; |
1640 | /* don't check MAY_WRITE - a newly created file may not have | 1641 | /* don't check MAY_WRITE - a newly created file may not have |
1641 | * write mode bits, but POSIX allows the creating process to write */ | 1642 | * write mode bits, but POSIX allows the creating process to write. |
1642 | if (fmode & FMODE_READ) | 1643 | * use openflags to check for exec, because fmode won't |
1643 | mask |= MAY_READ; | 1644 | * always have FMODE_EXEC set when file open for exec. */ |
1644 | if (fmode & FMODE_EXEC) | 1645 | if (openflags & __FMODE_EXEC) { |
1645 | mask |= MAY_EXEC; | 1646 | /* ONLY check for exec rights */ |
1647 | mask = MAY_EXEC; | ||
1648 | } else if (fmode & FMODE_READ) | ||
1649 | mask = MAY_READ; | ||
1646 | 1650 | ||
1647 | cache.cred = cred; | 1651 | cache.cred = cred; |
1648 | cache.jiffies = jiffies; | 1652 | cache.jiffies = jiffies; |
@@ -1896,7 +1900,7 @@ static int _nfs4_do_open(struct inode *dir, | |||
1896 | if (server->caps & NFS_CAP_POSIX_LOCK) | 1900 | if (server->caps & NFS_CAP_POSIX_LOCK) |
1897 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); | 1901 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); |
1898 | 1902 | ||
1899 | status = nfs4_opendata_access(cred, opendata, state, fmode); | 1903 | status = nfs4_opendata_access(cred, opendata, state, fmode, flags); |
1900 | if (status != 0) | 1904 | if (status != 0) |
1901 | goto err_opendata_put; | 1905 | goto err_opendata_put; |
1902 | 1906 | ||