In test_cpucg_nice, the forked child process incorrectly jumps to the
parent's cleanup label on cg_write failure. This causes the child to
attempt cg_destroy on cgroups the parent is still using, and then
return to main() to continue executing tests as if it were the parent.
Replace goto cleanup with exit(EXIT_FAILURE) in the child process.
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
char buf[64];
snprintf(buf, sizeof(buf), "%d", getpid());
if (cg_write(cpucg, "cgroup.procs", buf))
- goto cleanup;
+ exit(EXIT_FAILURE);
/* Try to keep niced CPU usage as constrained to hog_cpu as possible */
nice(1);