Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f17fc25f authored by Tejun Heo's avatar Tejun Heo
Browse files

cgroup: make css_tryget_online_from_dir() also recognize cgroup2 fs



The function currently returns -EBADF for a directory on the default
hierarchy.  Make it also recognize cgroup2_fs_type.  This will be used
for perf_event cgroup2 support.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent b38e42e9
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -5781,12 +5781,13 @@ struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
						       struct cgroup_subsys *ss)
						       struct cgroup_subsys *ss)
{
{
	struct kernfs_node *kn = kernfs_node_from_dentry(dentry);
	struct kernfs_node *kn = kernfs_node_from_dentry(dentry);
	struct file_system_type *s_type = dentry->d_sb->s_type;
	struct cgroup_subsys_state *css = NULL;
	struct cgroup_subsys_state *css = NULL;
	struct cgroup *cgrp;
	struct cgroup *cgrp;


	/* is @dentry a cgroup dir? */
	/* is @dentry a cgroup dir? */
	if (dentry->d_sb->s_type != &cgroup_fs_type || !kn ||
	if ((s_type != &cgroup_fs_type && s_type != &cgroup2_fs_type) ||
	    kernfs_type(kn) != KERNFS_DIR)
	    !kn || kernfs_type(kn) != KERNFS_DIR)
		return ERR_PTR(-EBADF);
		return ERR_PTR(-EBADF);


	rcu_read_lock();
	rcu_read_lock();