]> Pileus Git - ~andy/linux/blobdiff - fs/btrfs/inode.c
Btrfs: join the transaction in __btrfs_setxattr
[~andy/linux] / fs / btrfs / inode.c
index 95ea58cb3065caf577aac23d4db5cf8fb30281e8..5792816d4fca8f40c5be6dad4945b8f6dfc29b38 100644 (file)
@@ -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);