From ad929bcc27e2c6c1aa731053e45882686e9babab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Jul 2013 20:31:18 +0200 Subject: disable the cgroups release agent when shutting down During shutdown, when we try to clean up all remaining processes, the kernel will fork new agents every time a cgroup runs empty. These new processes cause delays in the final SIGTERM, SIGKILL logic. Apart from that, this should also avoid that the kernel-forked binaries cause unpredictably timed access to the filesystem which we might need to unmount. --- src/shared/cgroup-util.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/shared/cgroup-util.c') diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index 390259e3e4..73013d1d97 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -790,6 +790,21 @@ int cg_install_release_agent(const char *controller, const char *agent) { return 0; } +int cg_uninstall_release_agent(const char *controller) { + _cleanup_free_ char *fs = NULL; + int r; + + r = cg_get_path(controller, NULL, "release_agent", &fs); + if (r < 0) + return r; + + r = write_string_file(fs, ""); + if (r < 0) + return r; + + return 0; +} + int cg_is_empty(const char *controller, const char *path, bool ignore_self) { _cleanup_fclose_ FILE *f = NULL; pid_t pid = 0, self_pid; -- cgit v1.2.3-54-g00ecf