btrfs: honor umask when creating subvol root
Florian Albrechtskirchinger [Fri, 10 Feb 2012 21:15:54 +0000 (22:15 +0100)]
Set the subvol root inode permissions based on the current umask.

fs/btrfs/inode.c

index bf392e5..6e0ee9b 100644 (file)
@@ -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;