From 949b3fcc43e3badfc5f7fe0848c4b1c7690c8e32 Mon Sep 17 00:00:00 2001 From: "Franklin \"Snaipe\" Mathieu" Date: Mon, 5 Feb 2024 22:00:20 +0100 Subject: [PATCH] cgroup,cleaner: wait on level-triggered transitions The old code used edge-triggered transitions for epoll_wait on the cgroup.events file, which meant we were losing some events if we weren't fast enough to process them. This, in turn, caused the unlucky cleaner processes to hang on an epoll_wait, unable to clean up the unpopulated cgroup. With this commit, we now operate on level-triggered transitions, which allows cleaners to do their jobs properly. --- cgroup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cgroup.c b/cgroup.c index ba10209..fa7857b 100644 --- a/cgroup.c +++ b/cgroup.c @@ -164,7 +164,7 @@ static void run_cleaner_child(int lock, int parentfd, const char *name) } struct epoll_event event = { - .events = EPOLLET, + .events = 0, }; int epollfd = epoll_create1(0); @@ -192,8 +192,7 @@ static void run_cleaner_child(int lock, int parentfd, const char *name) for (;;) { int ready = epoll_wait(epollfd, &event, 1, -1); if (ready == -1 && errno != EINTR) { - warn("run_cgroup_child: epoll_wait cgroup.events"); - goto recursiveClean; + err(1, "run_cgroup_child: epoll_wait cgroup.events"); } rewind(eventsfp);