cgroup_config_create_template_group: properly detect whether template group was 
created

Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com>
---

 src/config.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/config.c b/src/config.c
index b2b8a13..06f559b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1566,6 +1566,7 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
        char buffer[FILENAME_MAX];
        struct cgroup *aux_cgroup;
        struct cgroup_controller *cgc;
+       int found;
 
        /*
         * If the user did not ask for cached rules, we must parse the
@@ -1590,6 +1591,7 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
                /* for each controller we have to add to cgroup structure
                 * either template cgroup or empty controller  */
 
+               found = 0;
                /* look for relevant template - test name x controller pair */
                for (j = 0; j < template_table_index; j++) {
 
@@ -1625,12 +1627,16 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
                                } else {
                                        /* go to new controller */
                                        j = template_table_index;
+                                       found = 1;
                                        continue;
                                }
 
                        }
                }
 
+               if (found == 1)
+                       continue;
+
                /* no template is present for given name x controller pair
                 * add controller to result cgroup */
                aux_cgroup = cgroup_new_cgroup(cgroup->name);


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to