diff --git a/[refs] b/[refs] index 505a6d4d4047..cdc6322f90ab 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bd56b30205bc09da0beb80d4ba3d4c7309792da5 +refs/heads/master: 8c087b5183adab186a298f2d6ed39aefdcae413c diff --git a/trunk/fs/btrfs/inode.c b/trunk/fs/btrfs/inode.c index 95ea58cb3065..5792816d4fca 100644 --- a/trunk/fs/btrfs/inode.c +++ b/trunk/fs/btrfs/inode.c @@ -3472,7 +3472,14 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, root->highest_inode = objectid; inode->i_uid = current_fsuid(); - inode->i_gid = current_fsgid(); + + if (dir->i_mode & S_ISGID) { + inode->i_gid = dir->i_gid; + if (S_ISDIR(mode)) + mode |= S_ISGID; + } else + inode->i_gid = current_fsgid(); + inode->i_mode = mode; inode->i_ino = objectid; inode_set_bytes(inode, 0);