Commit 3fbc10f7 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

cgroup: Drop useless check e->n_properties > 0

As for-cycle already checks it.
While at it - add local CgroupPropEntry variable and use it.
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 610e1536
...@@ -1320,26 +1320,24 @@ static int prepare_cgroup_dir_properties(char *path, int off, CgroupDirEntry **e ...@@ -1320,26 +1320,24 @@ static int prepare_cgroup_dir_properties(char *path, int off, CgroupDirEntry **e
goto skip; /* skip root cgroups */ goto skip; /* skip root cgroups */
off2 += sprintf(path + off, "/%s", e->dir_name); off2 += sprintf(path + off, "/%s", e->dir_name);
if (e->n_properties > 0) { for (j = 0; j < e->n_properties; ++j) {
for (j = 0; j < e->n_properties; ++j) { CgroupPropEntry *p = e->properties[j];
if (!strcmp(e->properties[j]->name, "freezer.state")) {
add_freezer_state_for_restore(e->properties[j], path, off2);
continue; /* skip restore now */
}
/* Skip restoring special cpuset props now. if (!strcmp(p->name, "freezer.state")) {
* They were restored earlier, and can cause add_freezer_state_for_restore(p, path, off2);
* the restore to fail if some other task has continue; /* skip restore now */
* entered the cgroup. }
*/
if (is_special_property(e->properties[j]->name))
continue;
if (restore_cgroup_prop(e->properties[j], path, off2, false) < 0) { /* Skip restoring special cpuset props now.
return -1; * They were restored earlier, and can cause
} * the restore to fail if some other task has
* entered the cgroup.
*/
if (is_special_property(p->name))
continue;
} if (restore_cgroup_prop(p, path, off2, false) < 0)
return -1;
} }
skip: skip:
if (prepare_cgroup_dir_properties(path, off2, e->children, e->n_children) < 0) if (prepare_cgroup_dir_properties(path, off2, e->children, e->n_children) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment