On Tue 27-05-14 18:35:45, Michal Hocko wrote:
> Hi,
> I have the following /etc/cgconfig.conf:
> mount {
>         memory = /sys/fs/cgroup/memory;
> }
> 
> group foo {
>         perm {
>                 task {
>                         uid = root;
>                         gid = users;
>                         fperm = 660;
>                 }
>                 admin {
>                         uid = root;
>                         gid = root;
>                         fperm = 600;
>                         dperm = 750;
>                 }
>         }
> }

OK, just found out that the configuration is not 100% valid. Group
declaration is missing a controller part. I thought that all controllers
with they default parameters are used if none is provided.

Man page says:
"
controller
      Name of the kernel subsystem.  The section can be empty, default
      kernel parameters will be used in this case.  By specifying con‐
      troller the control group and all its parents are controlled by
      the specific subsystem. One control group can be controlled by
      multiple subsystems, even if the subsystems are mounted on
      different directories. Each control group must be controlled by at
      least one subsystem, so that libcgroup knows in which hierarchies
      the control group should be created.
"

I seem to misinterpret "The section can be empty" part. Would it make
sense to warn about cgroups defined without any controller specified?
Something like a quick hack:

diff --git a/src/api.c b/src/api.c
index bfd0177b987c..0b50f847414f 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1579,7 +1579,7 @@ int cgroup_create_cgroup(struct cgroup *cgroup, int 
ignore_ownership)
        int retval = 0;
        int ret;
 
-       if (!cgroup_initialized)
+       if (!cgroup_initialized || !cgroup->index)
                return ECGROUPNOTINITIALIZED;
 
        if (!cgroup)

-- 
Michal Hocko
SUSE Labs

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to