Quoting Jan Safranek (jsafr...@redhat.com): > On 08/18/2011 09:19 PM, Serge E. Hallyn wrote: > > 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 > > > > > ++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; > > This can easily turn into endless loop. IMHO it would be better to try > it only few times and maybe only if a new flag is provided to > cgroup_delete_cgroup_ext(). The function could return something like > ECGAGAIN if several retries failed, so the caller knows what is going on > and can either retry by itself or report something to user.
Yup, I don't know what sorts of guarantees you want to provide, or pretend to provide. Really it seems you need the kernel to provide a feature where rmdir /cgroup/x/y/z moves any tasks in z into y. (In that sense it's at least more cleanly solvable than the fact that you can't guarantee reclassifying a task which does a quick fork+exit). But regardless what you do with this snipped, the earlier snippet is more of a problem, bc it will start to 'clean up' but then bail early for no actual good reason, leaving things in an in-between state, leaving the cgroups mounted, and leaving the caller confused. -serge ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel