From 49f3fffd94591bdf2bd6c2233a9300daeab79566 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 6 Aug 2015 16:50:54 +0300 Subject: machined: rework state tracking logic for machines This splits up the stopping logic for machines into two steps: first on machine_stop() we begin with the shutdown of a machine by queuing the stop method call for it. Then, in machine_finalize() we actually remove the rest of its runtime context. This mimics closely how sessions are handled in logind. This also reworks the GC logic to strictly check the current state of the machine unit, rather than shortcutting a few cases, like for example assuming that UnitRemoved really means a machine is gone (which it isn't since Reloading might trigger it, see #376). Fixes #376. --- src/machine/machine.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/machine/machine.h') diff --git a/src/machine/machine.h b/src/machine/machine.h index b1cd26662f..0132b65a97 100644 --- a/src/machine/machine.h +++ b/src/machine/machine.h @@ -82,6 +82,7 @@ struct Machine { bool in_gc_queue:1; bool started:1; + bool stopping:1; sd_bus_message *create_message; @@ -100,6 +101,7 @@ bool machine_check_gc(Machine *m, bool drop_not_started); void machine_add_to_gc_queue(Machine *m); int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error); int machine_stop(Machine *m); +int machine_finalize(Machine *m); int machine_save(Machine *m); int machine_load(Machine *m); int machine_kill(Machine *m, KillWho who, int signo); -- cgit v1.2.3-54-g00ecf