Thread (17 messages) 17 messages, 4 authors, 2022-08-04
STALE1409d REVIEWED: 6 (6M)
Revisions (4)
  1. v6 current
  2. v7 [diff vs current]
  3. v8 [diff vs current]
  4. v9 [diff vs current]

[PATCH bpf-next v6 2/8] cgroup: enable cgroup_get_from_file() on cgroup1

From: Hao Luo <hidden>
Date: 2022-08-01 17:55:02
Also in: bpf, cgroups, lkml
Subsystem: control group (cgroup), the rest · Maintainers: Tejun Heo, Johannes Weiner, Michal Koutný, Linus Torvalds

From: Yosry Ahmed <redacted>

From: Yosry Ahmed <redacted>

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 <redacted>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Hao Luo <redacted>
---
 kernel/cgroup/cgroup.c | 5 -----
 1 file changed, 5 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 13c8e91d7862..49803849a289 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -6099,11 +6099,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;
 }
 
-- 
2.37.1.455.g008518b4e5-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help