From fdd612b8242281ac599c220726155202c71549a8 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 7 Jan 2019 15:48:39 +0100 Subject: generators: avoid contacting syslog with generators The systemd generators are executed very early during the switch from initramfs to system partition and the syslog is not yet fully operational - it may cause blocking, if some debug logging is enabled at the same time in /etc/lvm/lvm.conf log{} section. To avoid timeouting and killing this generator - rather enhance lvm code to suppress any syslog communication when LVM_SUPPRESS_SYSLOG envvar is set. Use of this envvar is needed since the parsing of i.e. cmdline options that could eventually override lvm.conf setting happens in this case way too late and number of lines could have been already streamed to syslog. --- scripts/generator-internals.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/generator-internals.c b/scripts/generator-internals.c index 839206563..733e8189c 100644 --- a/scripts/generator-internals.c +++ b/scripts/generator-internals.c @@ -72,6 +72,9 @@ static bool _open_child(struct child_process *child, const char *cmd, const char (void) close(pipe_fd[1]); } + /* Suppressing any use of syslog */ + (void) setenv("LVM_SUPPRESS_SYSLOG", "1", 1); + if (execv(cmd, (char *const *) argv) < 0) _error("execv failed: %s\n", strerror(errno)); // Shouldn't get here unless exec failed. -- cgit v1.2.1