summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-18 10:02:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-18 10:02:17 -0700
commit20fb1936dee63fe397236d4ff3fd253a62b7b0b8 (patch)
treebbabde4f08ec8388549083df426fdcc6ffd2f82a /fs/open.c
parent1ce41cd849d476f45b2dccaf40b39fe6c4f8d793 (diff)
parent62b2ce964bb901f00a480104bd35a2e1f8d2cf58 (diff)
Merge branch 'vfs-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs
Pull vfs fixes from Miklos Szeredi. This mainly fixes some confusion about whether the open 'mode' variable passed around should contain the full file type (S_IFREG etc) information or just the permission mode. In particular, the lack of proper file type information had confused fuse. * 'vfs-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs: vfs: fix propagation of atomic_open create error on negative dentry fuse: check create mode in atomic open vfs: pass right create mode to may_o_create() vfs: atomic_open(): fix create mode usage vfs: canonicalize create mode in build_open_flags()
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index bc132e167d2d..e1f2cdb91a4d 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -852,9 +852,10 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
int lookup_flags = 0;
int acc_mode;
- if (!(flags & O_CREAT))
- mode = 0;
- op->mode = mode;
+ if (flags & O_CREAT)
+ op->mode = (mode & S_IALLUGO) | S_IFREG;
+ else
+ op->mode = 0;
/* Must never be set by userspace */
flags &= ~FMODE_NONOTIFY;