Hi, cgclear seems to assume that the system is frozen while it does its thing. I need the following patch in order to get cgclear to both catch all tasks, and not spuriously fail bc some task exited.
Is there another way you'd prefer to do this? -serge +Description: Fix race conditions in cgclear which can make 'stop cgconfig' fail + If a task exits after cgclear starts but before it has reclassified it, + don't return an error. Also, if a task has been created during that time, + then we simply need to re-start the reclassification loop. +Author: Serge Hallyn <serge.hal...@canonical.com> +Forwarded: no +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcgroup/+bug/827279 + +Index: libcgroup-0.37.1/src/api.c +=================================================================== +--- libcgroup-0.37.1.orig/src/api.c 2011-08-16 18:10:59.833551136 -0500 ++++ libcgroup-0.37.1/src/api.c 2011-08-16 18:12:40.583549430 -0500 +@@ -1671,15 +1671,24 @@ + break; + + ret = fprintf(output_tasks, "%d", tids); +- if (ret < 0) +- break; ++ if (ret < 0) { ++ if (errno != ESRCH) ++ break; ++ // the task just went away, ignore it ++ ret = 0; ++ continue; ++ } + + /* + * Flush the file, we need only one process per write() call. + */ + ret = fflush(output_tasks); +- if (ret < 0) +- break; ++ if (ret < 0 ) { ++ if (errno != ESRCH) ++ break; ++ // the task just went away, ignore it ++ ret = 0 ; ++ } + } + + if (ret < 0) { +@@ -1715,6 +1724,7 @@ + + cgroup_dbg("Removing group %s:%s\n", controller, cgroup_name); + ++again: + /* + * Open tasks file of the group to delete. + */ +@@ -1748,6 +1758,9 @@ + + ret = rmdir(path); + if (ret != 0 && errno != ENOENT) { ++ if (errno == EBUSY) ++ // more tasks have come up ++ goto again; + last_errno = errno; + return ECGOTHER; + } ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel