From: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Date: Fri, 10 Feb 2012 21:15:54 +0000 (+0100)
Subject: btrfs: honor umask when creating subvol root
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=12fc9d0923ca70ae8960bccebac09d5c12f8c4d4;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

btrfs: honor umask when creating subvol root

Set the subvol root inode permissions based on the current umask.
---

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index bf392e532617..6e0ee9b0d742 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6706,8 +6706,10 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
 	int err;
 	u64 index = 0;
 
-	inode = btrfs_new_inode(trans, new_root, NULL, "..", 2, new_dirid,
-				new_dirid, S_IFDIR | 0700, &index);
+	inode = btrfs_new_inode(trans, new_root, NULL, "..", 2,
+				new_dirid, new_dirid,
+				S_IFDIR | (~current_umask() & S_IRWXUGO),
+				&index);
 	if (IS_ERR(inode))
 		return PTR_ERR(inode);
 	inode->i_op = &btrfs_dir_inode_operations;