Bug 1057676
| Summary: | Cgroup templates not getting applied because of bad struct copy | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Josko Plazonic <plazonic> |
| Component: | libcgroup | Assignee: | Jan Chaloupka <jchaloup> |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat Kernel QE team <kernel-qe> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.6 | CC: | ccui, gbailey, jsafrane, ovasik, varekova |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-10-14 06:44:59 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-1480.html |
Description of problem: With the latest libcgroup-0.40.rc1-5.el6_5.1 in our testing we had template limits (like template users/%u in cgconfig.conf) not getting applied to users. We tracked it down to: cgroup_copy_cgroup(&config_template_table[i], &template_table[i]); line 1533 of src/config.c - which has the wrong order (should be DEST,SRC) so the just parsed config_template_table is getting overwritten with an empty one. Also template name and other params are not getting copied. Indeed 0.41 version of libcgroup has that fixed. Version-Release number of selected component (if applicable): libcgroup-0.40.rc1-5.el6_5.1 How reproducible: every time Steps to Reproduce: 1. add to /etc/cgconfig.conf template like: group everyone { cpu { cpu.shares = 100; } memory { memory.limit_in_bytes = 61G; memory.memsw.limit_in_bytes = 65G; memory.use_hierarchy = 1; } } template everyone/%u { cpu { cpu.shares = 10; } memory { memory.limit_in_bytes = 30G; memory.memsw.limit_in_bytes = 32G; } } 2. and add to /etc/cgrules.conf: * cpu,memory everyone/%u 3. Start cgconfig and cgred services, login as a user Actual results: Check /cgroups/everyone/username/memory.limits_in_bytes and notice that there are no limits imposed. Expected results: Expecting limits as specified. Additional info: This is fixed in libcgroup-0.41 - this is the relevant excerpt from diff on src/config.c: @@ -1483,7 +1483,24 @@ } for (i = 0; i < template_table_index; i++) { - cgroup_copy_cgroup(&config_template_table[i], &template_table[i]); + cgroup_copy_cgroup(&template_table[i], + &config_template_table[i]); + strcpy((template_table[i]).name, + (config_template_table[i]).name); + template_table[i].tasks_uid = + config_template_table[i].tasks_uid; + template_table[i].tasks_gid = + config_template_table[i].tasks_gid; + template_table[i].task_fperm = + config_template_table[i].task_fperm; + template_table[i].control_uid = + config_template_table[i].control_uid; + template_table[i].control_gid = + config_template_table[i].control_gid; + template_table[i].control_fperm = + config_template_table[i].control_fperm; + template_table[i].control_dperm = + config_template_table[i].control_dperm; } return ret; @@ -1530,7 +1547,24 @@ } for (i = 0; i < template_table_index; i++) { - cgroup_copy_cgroup(&config_template_table[i], &template_table[i]); + cgroup_copy_cgroup(&template_table[i], + &config_template_table[i]); + strcpy((template_table[i]).name, + (config_template_table[i]).name); + template_table[i].tasks_uid = + config_template_table[i].tasks_uid; + template_table[i].tasks_gid = + config_template_table[i].tasks_gid; + template_table[i].task_fperm = + config_template_table[i].task_fperm; + template_table[i].control_uid = + config_template_table[i].control_uid; + template_table[i].control_gid = + config_template_table[i].control_gid; + template_table[i].control_fperm = + config_template_table[i].control_fperm; + template_table[i].control_dperm = + config_template_table[i].control_dperm; } return ret;