diff options
| -rw-r--r-- | fs/nfs/dir.c | 2 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index bd91b2778315..e257172d438c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1110,7 +1110,7 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
| 1110 | if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) | 1110 | if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) |
| 1111 | goto no_open_dput; | 1111 | goto no_open_dput; |
| 1112 | /* We can't create new files, or truncate existing ones here */ | 1112 | /* We can't create new files, or truncate existing ones here */ |
| 1113 | openflags &= ~(O_CREAT|O_TRUNC); | 1113 | openflags &= ~(O_CREAT|O_EXCL|O_TRUNC); |
| 1114 | 1114 | ||
| 1115 | /* | 1115 | /* |
| 1116 | * Note: we're not holding inode->i_mutex and so may be racing with | 1116 | * Note: we're not holding inode->i_mutex and so may be racing with |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6b44bbfb7d8a..089da5b5d20a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -2036,7 +2036,8 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 2036 | struct rpc_cred *cred; | 2036 | struct rpc_cred *cred; |
| 2037 | struct nfs4_state *state; | 2037 | struct nfs4_state *state; |
| 2038 | struct dentry *res; | 2038 | struct dentry *res; |
| 2039 | fmode_t fmode = nd->intent.open.flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); | 2039 | int open_flags = nd->intent.open.flags; |
| 2040 | fmode_t fmode = open_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); | ||
| 2040 | 2041 | ||
| 2041 | if (nd->flags & LOOKUP_CREATE) { | 2042 | if (nd->flags & LOOKUP_CREATE) { |
| 2042 | attr.ia_mode = nd->intent.open.create_mode; | 2043 | attr.ia_mode = nd->intent.open.create_mode; |
| @@ -2044,8 +2045,9 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 2044 | if (!IS_POSIXACL(dir)) | 2045 | if (!IS_POSIXACL(dir)) |
| 2045 | attr.ia_mode &= ~current_umask(); | 2046 | attr.ia_mode &= ~current_umask(); |
| 2046 | } else { | 2047 | } else { |
| 2048 | open_flags &= ~O_EXCL; | ||
| 2047 | attr.ia_valid = 0; | 2049 | attr.ia_valid = 0; |
| 2048 | BUG_ON(nd->intent.open.flags & O_CREAT); | 2050 | BUG_ON(open_flags & O_CREAT); |
| 2049 | } | 2051 | } |
| 2050 | 2052 | ||
| 2051 | cred = rpc_lookup_cred(); | 2053 | cred = rpc_lookup_cred(); |
| @@ -2054,7 +2056,7 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 2054 | parent = dentry->d_parent; | 2056 | parent = dentry->d_parent; |
| 2055 | /* Protect against concurrent sillydeletes */ | 2057 | /* Protect against concurrent sillydeletes */ |
| 2056 | nfs_block_sillyrename(parent); | 2058 | nfs_block_sillyrename(parent); |
| 2057 | state = nfs4_do_open(dir, &path, fmode, nd->intent.open.flags, &attr, cred); | 2059 | state = nfs4_do_open(dir, &path, fmode, open_flags, &attr, cred); |
| 2058 | put_rpccred(cred); | 2060 | put_rpccred(cred); |
| 2059 | if (IS_ERR(state)) { | 2061 | if (IS_ERR(state)) { |
| 2060 | if (PTR_ERR(state) == -ENOENT) { | 2062 | if (PTR_ERR(state) == -ENOENT) { |
