Revert "cgroup: enable cgroup_get_from_file() on cgroup1"

This reverts commit f3a2aebdd6.

The commit enabled looking up v1 cgroups via cgroup_get_from_file().
However, there are multiple users, including CLONE_INTO_CGROUP, which have
been assuming that it would only look up v2 cgroups. Returning v1 cgroups
breaks them.

Let's revert the commit and retry later with a separate lookup interface
which allows both v1 and v2.

Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/000000000000385cbf05ea3f1862@google.com
Cc: Yosry Ahmed <yosryahmed@google.com>
This commit is contained in:
Tejun Heo 2022-10-10 11:08:17 -10:00
parent 46307fd6e2
commit 03db771615

View file

@ -6234,6 +6234,11 @@ static struct cgroup *cgroup_get_from_file(struct file *f)
return ERR_CAST(css);
cgrp = css->cgroup;
if (!cgroup_on_dfl(cgrp)) {
cgroup_put(cgrp);
return ERR_PTR(-EBADF);
}
return cgrp;
}