]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: don't transition to start-post on cgroup empty event 31592/head
authorMike Yuan <me@yhndnzj.com>
Sat, 2 Mar 2024 13:22:51 +0000 (21:22 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 5 Mar 2024 02:45:52 +0000 (10:45 +0800)
with ExitType=cgroup

It's not clear to me what the rationale of the logic was
when ExitType=cgroup got introduced. But similar to
the previous commit, I think we should not transition to
'start-post' on cgroup empty event. This is especially
important for Type=dbus/notify services.

src/core/service.c

index a2a8e4af697ba0aaa11172ad13679b9846770338..a9047be1cafdb2a698847f4393e579a75b55f1bf 100644 (file)
@@ -3604,8 +3604,10 @@ static void service_notify_cgroup_empty_event(Unit *u) {
                         break;
                 }
 
-                if (s->exit_type == SERVICE_EXIT_CGROUP && main_pid_good(s) <= 0)
-                        service_enter_start_post(s);
+                if (s->exit_type == SERVICE_EXIT_CGROUP && main_pid_good(s) <= 0) {
+                        service_enter_stop_post(s, SERVICE_SUCCESS);
+                        break;
+                }
 
                 _fallthrough_;
         case SERVICE_START_POST: