Compare commits

..

No commits in common. "437f48a471f51ac9dd2697ee3b848a71b4f101df" and "cee33a7ab33eb423c83dfb65e56788b6a06bffc9" have entirely different histories.

9 changed files with 40 additions and 37 deletions

11
NEWS
View File

@ -2,17 +2,6 @@ systemd System and Service Manager
CHANGES WITH 244 in spe:
* systemd-udevd: removed the 30s timeout for killing stale workers on
exit. systemd-udevd now waits for workers to finish. The hard-coded
exit timeout of 30s was too short for some large installations, where
driver initialization could be prematurely interrupted during initrd
processing if the root file system had been mounted and init was
preparing to switch root. If udevd is run without systemd and workers
are hanging while udevd receives an exit signal, udevd will now exit
when udev.event_timeout is reached for the last hanging worker. With
systemd, the exit timeout can additionally be configured using
TimeoutStopSec= in systemd-udevd.service.
* Support for the cpuset cgroups v2 controller has been added.
Processes may be restricted to specific CPUs using the new
AllowedCPUs= setting, and to specific memory NUMA nodes using the new

View File

@ -136,8 +136,9 @@
evaluated relative to the UNIX time epoch 1st Jan, 1970,
00:00.</para>
<para>Examples for valid timestamps and their normalized form (assuming the current time was 2012-11-23
18:15:22 and the timezone was UTC+8, for example <literal>TZ=:Asia/Shanghai</literal>):</para>
<para>Examples for valid timestamps and their normalized form
(assuming the current time was 2012-11-23 18:15:22 and the timezone
was UTC+8, for example TZ=Asia/Shanghai):</para>
<programlisting> Fri 2012-11-23 11:12:13 → Fri 2012-11-23 11:12:13
2012-11-23 11:12:13 → Fri 2012-11-23 11:12:13

View File

@ -832,12 +832,8 @@ int parse_timestamp(const char *t, usec_t *usec) {
}
if (r == 0) {
bool with_tz = true;
char *colon_tz;
/* tzset(3) says $TZ should be prefixed with ":" if we reference timezone files */
colon_tz = strjoina(":", tz);
if (setenv("TZ", colon_tz, 1) != 0) {
if (setenv("TZ", tz, 1) != 0) {
shared->return_value = negative_errno();
_exit(EXIT_FAILURE);
}

View File

@ -437,9 +437,14 @@ static int detect_unified_cgroup_hierarchy_from_environment(void) {
e = getenv(var);
if (!e) {
/* $UNIFIED_CGROUP_HIERARCHY has been renamed to $SYSTEMD_NSPAWN_UNIFIED_HIERARCHY. */
static bool warned = false;
var = "UNIFIED_CGROUP_HIERARCHY";
e = getenv(var);
if (e && !warned) {
log_info("$UNIFIED_CGROUP_HIERARCHY has been renamed to $SYSTEMD_NSPAWN_UNIFIED_HIERARCHY.");
warned = true;
}
}
if (!isempty(e)) {

View File

@ -1352,12 +1352,7 @@ int calendar_spec_next_usec(const CalendarSpec *spec, usec_t usec, usec_t *ret_n
return r;
}
if (r == 0) {
char *colon_tz;
/* tzset(3) says $TZ should be prefixed with ":" if we reference timezone files */
colon_tz = strjoina(":", spec->timezone);
if (setenv("TZ", colon_tz, 1) != 0) {
if (setenv("TZ", spec->timezone, 1) != 0) {
shared->return_value = negative_errno();
_exit(EXIT_FAILURE);
}

View File

@ -43,12 +43,9 @@ static void test_next(const char *input, const char *new_tz, usec_t after, usec_
if (old_tz)
old_tz = strdupa(old_tz);
if (new_tz) {
char *colon_tz;
colon_tz = strjoina(":", new_tz);
assert_se(setenv("TZ", colon_tz, 1) >= 0);
} else
if (new_tz)
assert_se(setenv("TZ", new_tz, 1) >= 0);
else
assert_se(unsetenv("TZ") >= 0);
tzset();

View File

@ -475,7 +475,7 @@ static void test_in_utc_timezone(void) {
assert_se(timezone == 0);
assert_se(daylight == 0);
assert_se(setenv("TZ", ":Europe/Berlin", 1) >= 0);
assert_se(setenv("TZ", "Europe/Berlin", 1) >= 0);
assert_se(!in_utc_timezone());
assert_se(streq(tzname[0], "CET"));
assert_se(streq(tzname[1], "CEST"));

View File

@ -46,7 +46,7 @@ typedef struct StatusInfo {
} StatusInfo;
static void print_status_info(const StatusInfo *i) {
const char *old_tz = NULL, *tz, *tz_colon;
const char *old_tz = NULL, *tz;
bool have_time = false;
char a[LINE_MAX];
struct tm tm;
@ -62,8 +62,7 @@ static void print_status_info(const StatusInfo *i) {
old_tz = strdupa(tz);
/* Set the new $TZ */
tz_colon = strjoina(":", isempty(i->timezone) ? "UTC" : i->timezone);
if (setenv("TZ", tz_colon, true) < 0)
if (setenv("TZ", isempty(i->timezone) ? "UTC" : i->timezone, true) < 0)
log_warning_errno(errno, "Failed to set TZ environment variable, ignoring: %m");
else
tzset();

View File

@ -293,8 +293,6 @@ static void manager_free(Manager *manager) {
if (!manager)
return;
manager->monitor = sd_device_monitor_unref(manager->monitor);
udev_builtin_exit();
if (manager->pid == getpid_cached())
@ -776,7 +774,21 @@ set_delaying_seqnum:
return true;
}
static int on_exit_timeout(sd_event_source *s, uint64_t usec, void *userdata) {
Manager *manager = userdata;
assert(manager);
log_error("Giving up waiting for workers to finish.");
sd_event_exit(manager->event, -ETIMEDOUT);
return 1;
}
static void manager_exit(Manager *manager) {
uint64_t usec;
int r;
assert(manager);
manager->exit = true;
@ -791,9 +803,18 @@ static void manager_exit(Manager *manager) {
manager->inotify_event = sd_event_source_unref(manager->inotify_event);
manager->fd_inotify = safe_close(manager->fd_inotify);
manager->monitor = sd_device_monitor_unref(manager->monitor);
/* discard queued events and kill workers */
event_queue_cleanup(manager, EVENT_QUEUED);
manager_kill_workers(manager);
assert_se(sd_event_now(manager->event, CLOCK_MONOTONIC, &usec) >= 0);
r = sd_event_add_time(manager->event, NULL, CLOCK_MONOTONIC,
usec + 30 * USEC_PER_SEC, USEC_PER_SEC, on_exit_timeout, manager);
if (r < 0)
return;
}
/* reload requested, HUP signal received, rules changed, builtin changed */