aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 95ea58cb3065..5792816d4fca 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3472,7 +3472,14 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
3472 root->highest_inode = objectid; 3472 root->highest_inode = objectid;
3473 3473
3474 inode->i_uid = current_fsuid(); 3474 inode->i_uid = current_fsuid();
3475 inode->i_gid = current_fsgid(); 3475
3476 if (dir->i_mode & S_ISGID) {
3477 inode->i_gid = dir->i_gid;
3478 if (S_ISDIR(mode))
3479 mode |= S_ISGID;
3480 } else
3481 inode->i_gid = current_fsgid();
3482
3476 inode->i_mode = mode; 3483 inode->i_mode = mode;
3477 inode->i_ino = objectid; 3484 inode->i_ino = objectid;
3478 inode_set_bytes(inode, 0); 3485 inode_set_bytes(inode, 0);