public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/files/, sys-fs/lvm2/
Date: Wed, 17 Apr 2019 07:26:51 +0000 (UTC)	[thread overview]
Message-ID: <1555485938.04b17140f5801dc924927a418f43cfe765afc778.robbat2@gentoo> (raw)

commit:     04b17140f5801dc924927a418f43cfe765afc778
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 17 07:04:10 2019 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Apr 17 07:25:38 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04b17140

sys-fs/lvm2: improve dmeventd init

Upstream dmeventd has an exit-on-idle behavior that leads openrc to
decide that it has crashed, when it just exited "normally".

Provide multiple ways around this:
- supervisor support in the init script
- patch the daemon to make the idle timeout configurable (submitted upstream)

Co-authored-by: William Hubbs <williamh <AT> gentoo.org>
Fixes: https://bugs.gentoo.org/682556
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 sys-fs/lvm2/files/dmeventd.initd-2.02.184-r2       | 21 +++++++
 .../lvm2-2.02.184-dmeventd-no-idle-exit.patch      | 68 ++++++++++++++++++++++
 sys-fs/lvm2/lvm2-2.02.184-r2.ebuild                |  3 +-
 3 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/sys-fs/lvm2/files/dmeventd.initd-2.02.184-r2 b/sys-fs/lvm2/files/dmeventd.initd-2.02.184-r2
new file mode 100644
index 00000000000..bc08c0a94f4
--- /dev/null
+++ b/sys-fs/lvm2/files/dmeventd.initd-2.02.184-r2
@@ -0,0 +1,21 @@
+#!/sbin/openrc-run
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+command=/sbin/dmeventd
+command_args_foreground='-f'
+extra_started_commands=reload
+pidfile=/run/dmeventd.pid
+# Control idle exit behavior of daemon
+export DMEVENTD_IDLE_EXIT_TIMEOUT=${DMEVENTD_IDLE_EXIT_TIMEOUT:=-1}
+
+depend() {
+	# As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that
+	# means dmeventd is NOT notified, as it cannot be safely running
+	after lvm device-mapper
+}
+
+reload() {
+	# TODO: this is not supported under supervisors
+	${command} -R
+}

diff --git a/sys-fs/lvm2/files/lvm2-2.02.184-dmeventd-no-idle-exit.patch b/sys-fs/lvm2/files/lvm2-2.02.184-dmeventd-no-idle-exit.patch
new file mode 100644
index 00000000000..c80bd2ba2be
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.184-dmeventd-no-idle-exit.patch
@@ -0,0 +1,68 @@
+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
+ .

diff --git a/sys-fs/lvm2/lvm2-2.02.184-r2.ebuild b/sys-fs/lvm2/lvm2-2.02.184-r2.ebuild
index 64a1656d31b..8ff1308f584 100644
--- a/sys-fs/lvm2/lvm2-2.02.184-r2.ebuild
+++ b/sys-fs/lvm2/lvm2-2.02.184-r2.ebuild
@@ -65,6 +65,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-2.02.171-static-libm.patch #617756
 	"${FILESDIR}"/${PN}-2.02.166-HPPA-no-O_DIRECT.patch #657446
 	#"${FILESDIR}"/${PN}-2.02.145-mkdev.patch #580062 # Merged upstream
+	"${FILESDIR}"/${PN}-2.02.184-dmeventd-no-idle-exit.patch
 )
 
 pkg_setup() {
@@ -213,7 +214,7 @@ src_install() {
 	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
 
 	if use !device-mapper-only ; then
-		newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
+		newinitd "${FILESDIR}"/dmeventd.initd-2.02.184-r2 dmeventd
 		newinitd "${FILESDIR}"/lvm.rc-2.02.183 lvm
 		newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
 


             reply	other threads:[~2019-04-17  7:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  7:26 Robin H. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-22 18:45 [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/files/, sys-fs/lvm2/ Sam James
2024-11-17 16:15 Mike Gilbert
2023-12-27 22:22 Sam James
2023-05-10 17:47 David Seifert
2023-03-07 14:20 David Seifert
2023-01-29 11:55 David Seifert
2022-12-22  3:12 Sam James
2022-10-26 23:11 Robin H. Johnson
2021-12-27  0:05 Lars Wendler
2021-10-20 12:20 Lars Wendler
2021-07-12 14:45 Mike Gilbert
2020-04-27  0:50 Thomas Deutschmann
2020-04-27  0:50 Thomas Deutschmann
2020-04-22 15:45 Thomas Deutschmann
2020-04-14 18:34 Thomas Deutschmann
2019-11-27 16:03 Lars Wendler
2019-06-02 22:31 Thomas Deutschmann
2019-04-08 19:11 Robin H. Johnson
2018-10-11 10:39 Lars Wendler
2018-08-04 22:13 Robin H. Johnson
2018-06-06  5:31 Jeroen Roovers
2018-05-08 17:11 Robin H. Johnson
2017-07-09 22:05 Robin H. Johnson
2017-02-18 21:29 Marc Schiffbauer
2017-02-13 20:09 Marc Schiffbauer
2016-10-21 23:15 Robin H. Johnson
2016-03-15  3:59 Doug Goldstein
2016-03-10 15:37 Robin H. Johnson
2016-01-05  2:56 Doug Goldstein
2015-12-28  0:30 Robin H. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1555485938.04b17140f5801dc924927a418f43cfe765afc778.robbat2@gentoo \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox