Skip to contentSkip to conversation

cgroup: return EINVAL in cgroup_subtree_control_write()

PATCH New Li Wang 1 participant 1 message Nov 2, 2023 cgroup

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 cgroup: return EINVAL in cgroup_subtree_control_write()

If add into the cgroup.subtree_control file with a subsystem name which is beyond the scope of the ones in the parent's cgroup.subtree_control file, the response is ’no such file or directory', which is confusing since the cgroup.subtree_control file is present, return EINVAL in this case.

---
 kernel/cgroup/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cgroup.c +1 -1
index 484adb375b15..77c1324ce0c1 100644
@@ -3391,7 +3391,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
 			}
 
 			if (!(cgroup_control(cgrp) & (1 << ssid))) {
-				ret = -ENOENT;
+				ret = -EINVAL;
 				goto out_unlock;
 			}
 		} else if (disable & (1 << ssid)) {
Signature · 1 line
2.34.1