summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2019-01-07 15:48:39 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2019-01-08 13:13:54 +0100
commitfdd612b8242281ac599c220726155202c71549a8 (patch)
treee8231d067016b4da14584108b108e65c8a964f5b /scripts
parent6298eaeca50e32cdff3adefdb57b09c3250547a2 (diff)
downloadlvm2-fdd612b8242281ac599c220726155202c71549a8.tar.gz
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generator-internals.c3
1 files changed, 3 insertions, 0 deletions
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.