Message ID | 20220722174829.3422466-3-yosryahmed@google.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | bpf: rstat: cgroup hierarchical stats | expand |
On Fri, Jul 22, 2022 at 05:48:23PM +0000, Yosry Ahmed wrote: > cgroup_get_from_file() currently fails with -EBADF if called on cgroup > v1. However, the current implementation works on cgroup v1 as well, so > the restriction is unnecessary. > > This enabled cgroup_get_from_fd() to work on cgroup v1, which would be > the only thing stopping bpf cgroup_iter from supporting cgroup v1. > > Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Acked-by: Tejun Heo <tj@kernel.org> Thanks.
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 1779ccddb734..9943fcb1e574 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6090,11 +6090,6 @@ 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; }
cgroup_get_from_file() currently fails with -EBADF if called on cgroup v1. However, the current implementation works on cgroup v1 as well, so the restriction is unnecessary. This enabled cgroup_get_from_fd() to work on cgroup v1, which would be the only thing stopping bpf cgroup_iter from supporting cgroup v1. Signed-off-by: Yosry Ahmed <yosryahmed@google.com> --- kernel/cgroup/cgroup.c | 5 ----- 1 file changed, 5 deletions(-)