aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2012-11-29 22:40:08 -0500
committerChris Mason <chris.mason@fusionio.com>2012-12-16 20:46:28 -0500
commit9185aa587b7425f8f4520da2e66792f5f3c2b815 (patch)
tree33ec92228186bbb37215a7e8db2c2a4519b102ad /fs
parent31e502298d80e2af9001d17dc419a3fd4b0bebef (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')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1673dbdf1f76..2e6918c85b72 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5041,6 +5041,10 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
5041 if (err) 5041 if (err)
5042 goto out_unlock; 5042 goto out_unlock;
5043 5043
5044 err = btrfs_update_inode(trans, root, inode);
5045 if (err)
5046 goto out_unlock;
5047
5044 /* 5048 /*
5045 * If the active LSM wants to access the inode during 5049 * If the active LSM wants to access the inode during
5046 * d_instantiate it needs these. Smack checks to see 5050 * d_instantiate it needs these. Smack checks to see