lkml.org 
[lkml]   [2017]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/4] cgroup: Child cgroup creation not allowed on invalid domain
Date
When thread mode is used, it is possible that some cgroups may be
in an invalid state. Currently users may not be aware that they are
invalid until they try to migrate tasks over. This patch disallows
child cgroup creation on invalid domain. This adds one more failure
point in reminding users that they are dealing with invalid domains.
It also minimizes the number of invalid domains outstanding as much
as possible.

Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/cgroup/cgroup.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index e9a377d..5fc8133 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4664,6 +4664,14 @@ int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, umode_t mode)
if (!parent)
return -ENODEV;

+ /*
+ * New cgroup creation isn't allowed on an invalid domain parent.
+ */
+ if (!cgroup_is_threaded(parent) && !cgroup_is_valid_domain(parent)) {
+ ret = -EOPNOTSUPP;
+ goto out_unlock;
+ }
+
cgrp = cgroup_create(parent);
if (IS_ERR(cgrp)) {
ret = PTR_ERR(cgrp);
--
1.8.3.1
\
 
 \ /
  Last update: 2017-07-21 22:37    [W:0.121 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site