68 lines
2.4 KiB
Diff
68 lines
2.4 KiB
Diff
From: "Robin H. Johnson" <robbat2@gentoo.org>
|
|
Date: Wed, 17 Apr 2019 06:54:27 +0000
|
|
Subject: [PATCH] dmeventd configurable idle exit time
|
|
|
|
dmeventd nominally exits after 1 hour of idle time. There are use cases for
|
|
this, esp. with socket activation, but also cases where users don't expect
|
|
dmeventd to exit.
|
|
|
|
Provide a tuning knob via environment variable, DMEVENTD_IDLE_EXIT_TIMEOUT,
|
|
that can be -1 to not exit, or a configurable time for different idle exit.
|
|
|
|
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
|
|
Fixes: https://bugs.gentoo.org/682556
|
|
|
|
diff -Nuar LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.184/daemons/dmeventd/dmeventd.c
|
|
--- LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c 2019-03-22 03:14:59.000000000 -0700
|
|
+++ LVM2.2.02.184/daemons/dmeventd/dmeventd.c 2019-04-17 00:18:23.535029906 -0700
|
|
@@ -2158,6 +2158,18 @@
|
|
.server_path = DM_EVENT_FIFO_SERVER
|
|
};
|
|
time_t now, idle_exit_timeout = DMEVENTD_IDLE_EXIT_TIMEOUT;
|
|
+
|
|
+ /* Provide a basic way to config the idle timeout */
|
|
+ char* idle_exit_timeout_env = getenv("DMEVENTD_IDLE_EXIT_TIMEOUT") ? : NULL;
|
|
+ if(NULL != idle_exit_timeout_env) {
|
|
+ char* endptr;
|
|
+ idle_exit_timeout = strtol(idle_exit_timeout_env, &endptr, 10);
|
|
+ if (errno == ERANGE || *endptr != '\0') {
|
|
+ fprintf(stderr, "DMEVENTD_IDLE_EXIT_TIMEOUT: bad time input\n");
|
|
+ exit(EXIT_FAILURE);
|
|
+ }
|
|
+ }
|
|
+
|
|
opterr = 0;
|
|
optind = 0;
|
|
|
|
@@ -2253,7 +2265,7 @@
|
|
_process_initial_registrations();
|
|
|
|
for (;;) {
|
|
- if (_idle_since) {
|
|
+ if (_idle_since || _exit_now) {
|
|
if (_exit_now) {
|
|
if (_exit_now == DM_SCHEDULED_EXIT)
|
|
break; /* Only prints shutdown message */
|
|
@@ -2262,7 +2274,7 @@
|
|
(long) (time(NULL) - _idle_since));
|
|
break;
|
|
}
|
|
- if (idle_exit_timeout) {
|
|
+ if (idle_exit_timeout && idle_exit_timeout > 0) {
|
|
now = time(NULL);
|
|
if (now < _idle_since)
|
|
_idle_since = now; /* clock change? */
|
|
diff -Nuar LVM2.2.02.184.orig/man/dmeventd.8_main LVM2.2.02.184/man/dmeventd.8_main
|
|
--- LVM2.2.02.184.orig/man/dmeventd.8_main 2019-03-22 03:15:00.000000000 -0700
|
|
+++ LVM2.2.02.184/man/dmeventd.8_main 2019-04-17 00:17:46.076023638 -0700
|
|
@@ -143,6 +143,10 @@
|
|
Variable is set by thin plugin to prohibit recursive interation
|
|
with dmeventd by any executed lvm2 command from
|
|
a thin_command environment.
|
|
+.TP
|
|
+.B DMEVENTD_IDLE_EXIT_TIMEOUT
|
|
+Configure the dmeventd idle exit timeout behavior, value in seconds. Default
|
|
+is 3600 (1 hour). -1 means do not exit.
|
|
.
|
|
.SH SEE ALSO
|
|
.
|