diff options
author | Filipe Brandenburger <filbranden@google.com> | 2012-11-29 22:40:08 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-12-16 20:46:16 -0500 |
commit | 2794ed013b3551cbae887ea1b93c52aaacb7370d (patch) | |
tree | b385459d5f7240dc53fdb08d2c1fbf487f0ed4ff /fs/btrfs | |
parent | 05dadc09f52ad5a631da1aa8767c5b80e121f0c4 (diff) |
Btrfs: fix permissions of empty files not affected by umask
When a new file is created with btrfs_create(), the inode will initially be
created with permissions 0666 and later on in btrfs_init_acl() it will be
adapted to mask out the umask bits. The problem is that this change won't make
it into the btrfs_inode unless there's another change to the inode (e.g. writing
content changing the size or touching the file changing the mtime.)
This fix adds a call to btrfs_update_inode() to btrfs_create() to make sure that
the change will not get lost if the in-memory inode is flushed before other
changes are made to the file.
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a1761f01cf11..adab791e1ce9 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4951,6 +4951,12 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
4951 | goto out_unlock; | 4951 | goto out_unlock; |
4952 | } | 4952 | } |
4953 | 4953 | ||
4954 | err = btrfs_update_inode(trans, root, inode); | ||
4955 | if (err) { | ||
4956 | drop_inode = 1; | ||
4957 | goto out_unlock; | ||
4958 | } | ||
4959 | |||
4954 | /* | 4960 | /* |
4955 | * If the active LSM wants to access the inode during | 4961 | * If the active LSM wants to access the inode during |
4956 | * d_instantiate it needs these. Smack checks to see | 4962 | * d_instantiate it needs these. Smack checks to see |