Bugs:
+* Don't try to connect to dbus during early boot
+
* Fix multiple reload statements
* sometimes processes seem to remain when we kill a service
automount_state_to_string(old_state),
automount_state_to_string(state));
- unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state], true);
}
static int automount_coldplug(Unit *u) {
device_state_to_string(old_state),
device_state_to_string(state));
- unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], true);
}
static int device_coldplug(Unit *u) {
mount_state_to_string(old_state),
mount_state_to_string(state));
- unit_notify(UNIT(m), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(m), state_translation_table[old_state], state_translation_table[state], !m->reload_failure);
+ m->reload_failure = false;
}
static int mount_coldplug(Unit *u) {
fail:
log_warning("%s failed to run 'remount' task: %s", m->meta.id, strerror(-r));
- mount_enter_mounted(m, false);
+ m->reload_failure = true;
+ mount_enter_mounted(m, true);
}
static int mount_start(Unit *u) {
case MOUNT_MOUNTING_DONE:
case MOUNT_MOUNTING_SIGKILL:
case MOUNT_MOUNTING_SIGTERM:
- case MOUNT_REMOUNTING:
- case MOUNT_REMOUNTING_SIGKILL:
- case MOUNT_REMOUNTING_SIGTERM:
if (success)
mount_enter_mounted(m, true);
mount_enter_dead(m, false);
break;
+ case MOUNT_REMOUNTING:
+ case MOUNT_REMOUNTING_SIGKILL:
+ case MOUNT_REMOUNTING_SIGTERM:
+
+ m->reload_failure = !success;
+ if (m->from_proc_self_mountinfo)
+ mount_enter_mounted(m, true);
+ else
+ mount_enter_dead(m, true);
+
+ break;
+
case MOUNT_UNMOUNTING:
case MOUNT_UNMOUNTING_SIGKILL:
case MOUNT_UNMOUNTING_SIGTERM:
case MOUNT_REMOUNTING:
log_warning("%s remounting timed out. Stopping.", u->meta.id);
- mount_enter_signal(m, MOUNT_REMOUNTING_SIGTERM, false);
+ m->reload_failure = true;
+ mount_enter_mounted(m, true);
break;
case MOUNT_UNMOUNTING:
bool just_changed:1;
bool failure:1;
+ bool reload_failure:1;
mode_t directory_mode;
path_state_to_string(old_state),
path_state_to_string(state));
- unit_notify(UNIT(p), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(p), state_translation_table[old_state], state_translation_table[state], true);
}
static void path_enter_waiting(Path *p, bool initial, bool recheck);
if (old_state != state)
log_debug("%s changed %s -> %s", s->meta.id, service_state_to_string(old_state), service_state_to_string(state));
- unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], !s->reload_failure);
+ s->reload_failure = false;
}
static int service_coldplug(Unit *u) {
fail:
log_warning("%s failed to run 'reload' task: %s", s->meta.id, strerror(-r));
- service_enter_stop(s, false);
+ s->reload_failure = true;
+ service_enter_running(s, true);
}
static void service_run_next_control(Service *s, bool success) {
service_enter_signal(s, SERVICE_STOP_SIGTERM, false);
else if (s->state == SERVICE_STOP_POST)
service_enter_dead(s, false, true);
- else
+ else if (s->state == SERVICE_RELOAD) {
+ s->reload_failure = true;
+ service_enter_running(s, true);
+ } else
service_enter_stop(s, false);
}
/* Fall through */
case SERVICE_RELOAD:
- if (success)
- service_enter_running(s, true);
- else
- service_enter_running(s, false);
-
+ s->reload_failure = !success;
+ service_enter_running(s, true);
break;
case SERVICE_STOP:
break;
case SERVICE_START_POST:
- case SERVICE_RELOAD:
log_warning("%s operation timed out. Stopping.", u->meta.id);
service_enter_stop(s, false);
break;
+ case SERVICE_RELOAD:
+ log_warning("%s operation timed out. Stopping.", u->meta.id);
+ s->reload_failure = true;
+ service_enter_running(s, true);
+ break;
+
case SERVICE_STOP:
log_warning("%s stopping timed out. Terminating.", u->meta.id);
service_enter_signal(s, SERVICE_STOP_SIGTERM, false);
/* If we shut down, remember why */
bool failure:1;
+ bool reload_failure:1;
+
bool main_pid_known:1;
bool bus_name_good:1;
bool forbid_restart:1;
snapshot_state_to_string(old_state),
snapshot_state_to_string(state));
- unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true);
}
static int snapshot_load(Unit *u) {
socket_state_to_string(old_state),
socket_state_to_string(state));
- unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true);
}
static int socket_coldplug(Unit *u) {
swap_state_to_string(old_state),
swap_state_to_string(state));
- unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true);
}
static int swap_coldplug(Unit *u) {
target_state_to_string(old_state),
target_state_to_string(state));
- unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], true);
}
static int target_add_default_dependencies(Target *t) {
timer_state_to_string(old_state),
timer_state_to_string(state));
- unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state]);
+ unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], true);
}
static void timer_enter_waiting(Timer *t, bool initial);
unit_check_unneeded(other);
}
-void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
+void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_success) {
dual_timestamp ts;
bool unexpected;
if (u->meta.job->state == JOB_RUNNING) {
if (ns == UNIT_ACTIVE)
- job_finish_and_invalidate(u->meta.job, true);
+ job_finish_and_invalidate(u->meta.job, reload_success);
else if (ns != UNIT_ACTIVATING && ns != UNIT_RELOADING) {
unexpected = true;
int unit_kill(Unit *u, KillWho w, KillMode m, int signo, DBusError *error);
-void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns);
+void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_success);
int unit_watch_fd(Unit *u, int fd, uint32_t events, Watch *w);
void unit_unwatch_fd(Unit *u, Watch *w);