|
|
984f77 |
From 207f51115c18c668982ef8bdb8a024fccaeb87f0 Mon Sep 17 00:00:00 2001
|
|
|
984f77 |
From: David Tardon <dtardon@redhat.com>
|
|
|
984f77 |
Date: Sat, 16 Jul 2022 09:49:12 +0200
|
|
|
984f77 |
Subject: [PATCH] core: allow to set default timeout for devices
|
|
|
984f77 |
|
|
|
984f77 |
Fixes: #19879
|
|
|
984f77 |
(cherry picked from commit a0fe19f9f791c05af236265954b1d73e8fcf5468)
|
|
|
984f77 |
|
|
|
984f77 |
Resolves: #1967245
|
|
|
984f77 |
---
|
|
|
984f77 |
src/core/dbus-manager.c | 1 +
|
|
|
984f77 |
src/core/device.c | 2 +-
|
|
|
984f77 |
src/core/main.c | 4 ++++
|
|
|
984f77 |
src/core/manager.c | 1 +
|
|
|
984f77 |
src/core/manager.h | 1 +
|
|
|
984f77 |
src/core/system.conf.in | 1 +
|
|
|
984f77 |
6 files changed, 9 insertions(+), 1 deletion(-)
|
|
|
984f77 |
|
|
|
984f77 |
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
|
|
|
984f77 |
index 7488f22116..5b1ed3646e 100644
|
|
|
984f77 |
--- a/src/core/dbus-manager.c
|
|
|
984f77 |
+++ b/src/core/dbus-manager.c
|
|
|
984f77 |
@@ -2509,6 +2509,7 @@ const sd_bus_vtable bus_manager_vtable[] = {
|
|
|
984f77 |
SD_BUS_PROPERTY("DefaultTimerAccuracyUSec", "t", bus_property_get_usec, offsetof(Manager, default_timer_accuracy_usec), SD_BUS_VTABLE_PROPERTY_CONST),
|
|
|
984f77 |
SD_BUS_PROPERTY("DefaultTimeoutStartUSec", "t", bus_property_get_usec, offsetof(Manager, default_timeout_start_usec), SD_BUS_VTABLE_PROPERTY_CONST),
|
|
|
984f77 |
SD_BUS_PROPERTY("DefaultTimeoutStopUSec", "t", bus_property_get_usec, offsetof(Manager, default_timeout_stop_usec), SD_BUS_VTABLE_PROPERTY_CONST),
|
|
|
984f77 |
+ SD_BUS_PROPERTY("DefaultDeviceTimeoutUSec", "t", bus_property_get_usec, offsetof(Manager, default_device_timeout_usec), SD_BUS_VTABLE_PROPERTY_CONST),
|
|
|
984f77 |
SD_BUS_PROPERTY("DefaultRestartUSec", "t", bus_property_get_usec, offsetof(Manager, default_restart_usec), SD_BUS_VTABLE_PROPERTY_CONST),
|
|
|
984f77 |
SD_BUS_PROPERTY("DefaultStartLimitIntervalUSec", "t", bus_property_get_usec, offsetof(Manager, default_start_limit_interval), SD_BUS_VTABLE_PROPERTY_CONST),
|
|
|
984f77 |
/* The following two items are obsolete alias */
|
|
|
984f77 |
diff --git a/src/core/device.c b/src/core/device.c
|
|
|
984f77 |
index cb8b66dfc5..71b7c1ef81 100644
|
|
|
984f77 |
--- a/src/core/device.c
|
|
|
984f77 |
+++ b/src/core/device.c
|
|
|
984f77 |
@@ -97,7 +97,7 @@ static void device_init(Unit *u) {
|
|
|
984f77 |
* indefinitely for plugged in devices, something which cannot
|
|
|
984f77 |
* happen for the other units since their operations time out
|
|
|
984f77 |
* anyway. */
|
|
|
984f77 |
- u->job_running_timeout = u->manager->default_timeout_start_usec;
|
|
|
984f77 |
+ u->job_running_timeout = u->manager->default_device_timeout_usec;
|
|
|
984f77 |
|
|
|
984f77 |
u->ignore_on_isolate = true;
|
|
|
984f77 |
|
|
|
984f77 |
diff --git a/src/core/main.c b/src/core/main.c
|
|
|
984f77 |
index 08a4df3c97..bfd4c531a7 100644
|
|
|
984f77 |
--- a/src/core/main.c
|
|
|
984f77 |
+++ b/src/core/main.c
|
|
|
984f77 |
@@ -109,6 +109,7 @@ static usec_t arg_default_restart_usec;
|
|
|
984f77 |
static usec_t arg_default_timeout_start_usec;
|
|
|
984f77 |
static usec_t arg_default_timeout_stop_usec;
|
|
|
984f77 |
static usec_t arg_default_timeout_abort_usec;
|
|
|
984f77 |
+static usec_t arg_default_device_timeout_usec;
|
|
|
984f77 |
static bool arg_default_timeout_abort_set;
|
|
|
984f77 |
static usec_t arg_default_start_limit_interval;
|
|
|
984f77 |
static unsigned arg_default_start_limit_burst;
|
|
|
984f77 |
@@ -687,6 +688,7 @@ static int parse_config_file(void) {
|
|
|
984f77 |
{ "Manager", "DefaultStandardError", config_parse_output_restricted,0, &arg_default_std_error },
|
|
|
984f77 |
{ "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec },
|
|
|
984f77 |
{ "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec },
|
|
|
984f77 |
+ { "Manager", "DefaultDeviceTimeoutSec", config_parse_sec, 0, &arg_default_device_timeout_usec },
|
|
|
984f77 |
{ "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec },
|
|
|
984f77 |
{ "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval }, /* obsolete alias */
|
|
|
984f77 |
{ "Manager", "DefaultStartLimitIntervalSec",config_parse_sec, 0, &arg_default_start_limit_interval },
|
|
|
984f77 |
@@ -754,6 +756,7 @@ static void set_manager_defaults(Manager *m) {
|
|
|
984f77 |
m->default_std_error = arg_default_std_error;
|
|
|
984f77 |
m->default_timeout_start_usec = arg_default_timeout_start_usec;
|
|
|
984f77 |
m->default_timeout_stop_usec = arg_default_timeout_stop_usec;
|
|
|
984f77 |
+ m->default_device_timeout_usec = arg_default_device_timeout_usec;
|
|
|
984f77 |
m->default_restart_usec = arg_default_restart_usec;
|
|
|
984f77 |
m->default_start_limit_interval = arg_default_start_limit_interval;
|
|
|
984f77 |
m->default_start_limit_burst = arg_default_start_limit_burst;
|
|
|
984f77 |
@@ -2077,6 +2080,7 @@ static void reset_arguments(void) {
|
|
|
984f77 |
arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
|
|
|
984f77 |
arg_default_timeout_abort_usec = DEFAULT_TIMEOUT_USEC;
|
|
|
984f77 |
arg_default_timeout_abort_set = false;
|
|
|
984f77 |
+ arg_default_device_timeout_usec = DEFAULT_TIMEOUT_USEC;
|
|
|
984f77 |
arg_default_start_limit_interval = DEFAULT_START_LIMIT_INTERVAL;
|
|
|
984f77 |
arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST;
|
|
|
984f77 |
arg_runtime_watchdog = 0;
|
|
|
984f77 |
diff --git a/src/core/manager.c b/src/core/manager.c
|
|
|
984f77 |
index 5873e5b6d7..f4611e6f8f 100644
|
|
|
984f77 |
--- a/src/core/manager.c
|
|
|
984f77 |
+++ b/src/core/manager.c
|
|
|
984f77 |
@@ -731,6 +731,7 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
|
|
|
984f77 |
m->default_tasks_max = UINT64_MAX;
|
|
|
984f77 |
m->default_timeout_start_usec = DEFAULT_TIMEOUT_USEC;
|
|
|
984f77 |
m->default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
|
|
|
984f77 |
+ m->default_device_timeout_usec = DEFAULT_TIMEOUT_USEC,
|
|
|
984f77 |
m->default_restart_usec = DEFAULT_RESTART_USEC;
|
|
|
984f77 |
m->original_log_level = -1;
|
|
|
984f77 |
m->original_log_target = _LOG_TARGET_INVALID;
|
|
|
984f77 |
diff --git a/src/core/manager.h b/src/core/manager.h
|
|
|
984f77 |
index 7b572c8dfd..3f2cfc5e2e 100644
|
|
|
984f77 |
--- a/src/core/manager.h
|
|
|
984f77 |
+++ b/src/core/manager.h
|
|
|
984f77 |
@@ -285,6 +285,7 @@ struct Manager {
|
|
|
984f77 |
ExecOutput default_std_output, default_std_error;
|
|
|
984f77 |
|
|
|
984f77 |
usec_t default_restart_usec, default_timeout_start_usec, default_timeout_stop_usec;
|
|
|
984f77 |
+ usec_t default_device_timeout_usec;
|
|
|
984f77 |
|
|
|
984f77 |
usec_t default_start_limit_interval;
|
|
|
984f77 |
unsigned default_start_limit_burst;
|
|
|
984f77 |
diff --git a/src/core/system.conf.in b/src/core/system.conf.in
|
|
|
984f77 |
index 84246c0e36..2f6852a89f 100644
|
|
|
984f77 |
--- a/src/core/system.conf.in
|
|
|
984f77 |
+++ b/src/core/system.conf.in
|
|
|
984f77 |
@@ -37,6 +37,7 @@
|
|
|
984f77 |
#DefaultStandardError=inherit
|
|
|
984f77 |
#DefaultTimeoutStartSec=90s
|
|
|
984f77 |
#DefaultTimeoutStopSec=90s
|
|
|
984f77 |
+#DefaultDeviceTimeoutSec=90s
|
|
|
984f77 |
#DefaultRestartSec=100ms
|
|
|
984f77 |
#DefaultStartLimitIntervalSec=10s
|
|
|
984f77 |
#DefaultStartLimitBurst=5
|