diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-02-15 13:15:45 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-02-15 14:09:40 +0100 |
commit | 554ce41f619f0a03b5fc777af4b923ff68fe13d4 (patch) | |
tree | 5f73d4a26216f57a44db0dcce9c26190a9d0d7d5 | |
parent | 5c093a23688ff4d98657da44c25848392a0caf69 (diff) | |
download | systemd-gc-cleanup.tar.gz |
machined: change check_gc to may_gc everywheregc-cleanup
-rw-r--r-- | src/machine/machine.c | 12 | ||||
-rw-r--r-- | src/machine/machine.h | 2 | ||||
-rw-r--r-- | src/machine/machined.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c index 7375d83a44..4bacf91d26 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -486,22 +486,22 @@ int machine_finalize(Machine *m) { return 0; } -bool machine_check_gc(Machine *m, bool drop_not_started) { +bool machine_may_gc(Machine *m, bool drop_not_started) { assert(m); if (m->class == MACHINE_HOST) - return true; + return false; if (drop_not_started && !m->started) - return false; + return true; if (m->scope_job && manager_job_is_active(m->manager, m->scope_job)) - return true; + return false; if (m->unit && manager_unit_is_active(m->manager, m->unit)) - return true; + return false; - return false; + return true; } void machine_add_to_gc_queue(Machine *m) { diff --git a/src/machine/machine.h b/src/machine/machine.h index 1ee82ffe81..1ef5dcdb89 100644 --- a/src/machine/machine.h +++ b/src/machine/machine.h @@ -85,7 +85,7 @@ struct Machine { Machine* machine_new(Manager *manager, MachineClass class, const char *name); void machine_free(Machine *m); -bool machine_check_gc(Machine *m, bool drop_not_started); +bool machine_may_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); diff --git a/src/machine/machined.c b/src/machine/machined.c index 34b2024043..9fb67882e1 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -292,14 +292,14 @@ void manager_gc(Manager *m, bool drop_not_started) { machine->in_gc_queue = false; /* First, if we are not closing yet, initiate stopping */ - if (!machine_check_gc(machine, drop_not_started) && + if (machine_may_gc(machine, drop_not_started) && machine_get_state(machine) != MACHINE_CLOSING) machine_stop(machine); /* Now, the stop probably made this referenced * again, but if it didn't, then it's time to let it * go entirely. */ - if (!machine_check_gc(machine, drop_not_started)) { + if (machine_may_gc(machine, drop_not_started)) { machine_finalize(machine); machine_free(machine); } |