mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
Merge pull request #13961 from mwilck/udev-no-exit-timeout
udevd: wait for workers to finish when exiting
This commit is contained in:
commit
7b631898ef
11
NEWS
11
NEWS
@ -2,6 +2,17 @@ systemd System and Service Manager
|
|||||||
|
|
||||||
CHANGES WITH 244 in spe:
|
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.
|
* Support for the cpuset cgroups v2 controller has been added.
|
||||||
Processes may be restricted to specific CPUs using the new
|
Processes may be restricted to specific CPUs using the new
|
||||||
AllowedCPUs= setting, and to specific memory NUMA nodes using the new
|
AllowedCPUs= setting, and to specific memory NUMA nodes using the new
|
||||||
|
@ -293,6 +293,8 @@ static void manager_free(Manager *manager) {
|
|||||||
if (!manager)
|
if (!manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
manager->monitor = sd_device_monitor_unref(manager->monitor);
|
||||||
|
|
||||||
udev_builtin_exit();
|
udev_builtin_exit();
|
||||||
|
|
||||||
if (manager->pid == getpid_cached())
|
if (manager->pid == getpid_cached())
|
||||||
@ -774,21 +776,7 @@ set_delaying_seqnum:
|
|||||||
return true;
|
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) {
|
static void manager_exit(Manager *manager) {
|
||||||
uint64_t usec;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(manager);
|
assert(manager);
|
||||||
|
|
||||||
manager->exit = true;
|
manager->exit = true;
|
||||||
@ -803,18 +791,9 @@ static void manager_exit(Manager *manager) {
|
|||||||
manager->inotify_event = sd_event_source_unref(manager->inotify_event);
|
manager->inotify_event = sd_event_source_unref(manager->inotify_event);
|
||||||
manager->fd_inotify = safe_close(manager->fd_inotify);
|
manager->fd_inotify = safe_close(manager->fd_inotify);
|
||||||
|
|
||||||
manager->monitor = sd_device_monitor_unref(manager->monitor);
|
|
||||||
|
|
||||||
/* discard queued events and kill workers */
|
/* discard queued events and kill workers */
|
||||||
event_queue_cleanup(manager, EVENT_QUEUED);
|
event_queue_cleanup(manager, EVENT_QUEUED);
|
||||||
manager_kill_workers(manager);
|
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 */
|
/* reload requested, HUP signal received, rules changed, builtin changed */
|
||||||
|
Loading…
Reference in New Issue
Block a user