--- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -760,7 +760,8 @@ static void __setattr_copy(struct inode if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; - if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) + if (!in_group_p(inode->i_gid) && + !capable_wrt_inode_uidgid(inode, CAP_FSETID)) mode &= ~S_ISGID; set_acl_inode(inode, mode); }