1
0
mirror of https://github.com/systemd/systemd synced 2025-11-21 01:34:44 +01:00

Compare commits

..

No commits in common. "cb1c039fbc5c14994cf70b0a873a70240a79fb16" and "675fa49f69943b0f009c973ed3d1e90afc1d88b1" have entirely different histories.

4 changed files with 12 additions and 36 deletions

View File

@ -144,16 +144,6 @@ FreezerState freezer_state_finish(FreezerState state) {
return freezer_state_finish_table[state]; return freezer_state_finish_table[state];
} }
FreezerState freezer_state_objective(FreezerState state) {
FreezerState objective;
objective = freezer_state_finish(state);
if (objective == FREEZER_FROZEN_BY_PARENT)
objective = FREEZER_FROZEN;
return objective;
}
static const char* const unit_marker_table[_UNIT_MARKER_MAX] = { static const char* const unit_marker_table[_UNIT_MARKER_MAX] = {
[UNIT_MARKER_NEEDS_RELOAD] = "needs-reload", [UNIT_MARKER_NEEDS_RELOAD] = "needs-reload",
[UNIT_MARKER_NEEDS_RESTART] = "needs-restart", [UNIT_MARKER_NEEDS_RESTART] = "needs-restart",

View File

@ -325,7 +325,6 @@ UnitActiveState unit_active_state_from_string(const char *s) _pure_;
const char* freezer_state_to_string(FreezerState i) _const_; const char* freezer_state_to_string(FreezerState i) _const_;
FreezerState freezer_state_from_string(const char *s) _pure_; FreezerState freezer_state_from_string(const char *s) _pure_;
FreezerState freezer_state_finish(FreezerState i) _const_; FreezerState freezer_state_finish(FreezerState i) _const_;
FreezerState freezer_state_objective(FreezerState state) _const_;
const char* unit_marker_to_string(UnitMarker m) _const_; const char* unit_marker_to_string(UnitMarker m) _const_;
UnitMarker unit_marker_from_string(const char *s) _pure_; UnitMarker unit_marker_from_string(const char *s) _pure_;

View File

@ -414,7 +414,7 @@ static void service_extend_timeout(Service *s, usec_t extend_timeout_usec) {
static void service_reset_watchdog(Service *s) { static void service_reset_watchdog(Service *s) {
assert(s); assert(s);
if (freezer_state_objective(UNIT(s)->freezer_state) != FREEZER_RUNNING) { if (freezer_state_finish(UNIT(s)->freezer_state) != FREEZER_RUNNING) {
log_unit_debug(UNIT(s), "Service is currently %s, skipping resetting watchdog.", log_unit_debug(UNIT(s), "Service is currently %s, skipping resetting watchdog.",
freezer_state_to_string(UNIT(s)->freezer_state)); freezer_state_to_string(UNIT(s)->freezer_state));
return; return;
@ -1425,7 +1425,7 @@ static int service_coldplug(Unit *u) {
(void) unit_setup_exec_runtime(u); (void) unit_setup_exec_runtime(u);
if (IN_SET(s->deserialized_state, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD, SERVICE_RELOAD_SIGNAL, SERVICE_RELOAD_NOTIFY, SERVICE_REFRESH_EXTENSIONS, SERVICE_MOUNTING) && if (IN_SET(s->deserialized_state, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD, SERVICE_RELOAD_SIGNAL, SERVICE_RELOAD_NOTIFY, SERVICE_REFRESH_EXTENSIONS, SERVICE_MOUNTING) &&
freezer_state_objective(u->freezer_state) == FREEZER_RUNNING) freezer_state_finish(u->freezer_state) == FREEZER_RUNNING)
service_start_watchdog(s); service_start_watchdog(s);
if (UNIT_ISSET(s->accept_socket)) { if (UNIT_ISSET(s->accept_socket)) {
@ -5643,33 +5643,18 @@ int service_determine_exec_selinux_label(Service *s, char **ret) {
return 0; return 0;
} }
static int service_freezer_action(Unit *u, FreezerAction action) { static int service_cgroup_freezer_action(Unit *u, FreezerAction action) {
Service *s = ASSERT_PTR(SERVICE(u)); Service *s = ASSERT_PTR(SERVICE(u));
FreezerState old_objective, new_objective;
int r; int r;
old_objective = freezer_state_objective(u->freezer_state);
r = unit_cgroup_freezer_action(u, action); r = unit_cgroup_freezer_action(u, action);
if (r < 0) if (r <= 0)
return r; return r;
new_objective = freezer_state_objective(u->freezer_state); if (action == FREEZER_FREEZE)
/* Note that we cannot trivially check the retval of unit_cgroup_freezer_action() here, since
* that signals whether the operation is ongoing from *kernel's PoV*. If the freeze operation
* is aborted, the frozen attribute of the cgroup would never have been flipped in kernel,
* and unit_cgroup_freezer_action() will happily return 0, yet the watchdog still needs to be reset;
* vice versa. */
if (old_objective != new_objective) {
if (new_objective == FREEZER_FROZEN)
service_stop_watchdog(s); service_stop_watchdog(s);
else if (new_objective == FREEZER_RUNNING) else if (action == FREEZER_THAW)
service_reset_watchdog(s); service_reset_watchdog(s);
else
assert_not_reached();
}
return r; return r;
} }
@ -5811,7 +5796,7 @@ const UnitVTable service_vtable = {
.live_mount = service_live_mount, .live_mount = service_live_mount,
.can_live_mount = service_can_live_mount, .can_live_mount = service_can_live_mount,
.freezer_action = service_freezer_action, .freezer_action = service_cgroup_freezer_action,
.serialize = service_serialize, .serialize = service_serialize,
.deserialize_item = service_deserialize_item, .deserialize_item = service_deserialize_item,

View File

@ -6438,7 +6438,9 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret_ne
assert_not_reached(); assert_not_reached();
} }
objective = freezer_state_objective(next); objective = freezer_state_finish(next);
if (objective == FREEZER_FROZEN_BY_PARENT)
objective = FREEZER_FROZEN;
assert(IN_SET(objective, FREEZER_RUNNING, FREEZER_FROZEN)); assert(IN_SET(objective, FREEZER_RUNNING, FREEZER_FROZEN));
*ret_next = next; *ret_next = next;