diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2019-01-07 15:48:39 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2019-01-08 13:13:54 +0100 |
commit | fdd612b8242281ac599c220726155202c71549a8 (patch) | |
tree | e8231d067016b4da14584108b108e65c8a964f5b /lib/log | |
parent | 6298eaeca50e32cdff3adefdb57b09c3250547a2 (diff) | |
download | lvm2-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 'lib/log')
-rw-r--r-- | lib/log/log.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/log/log.c b/lib/log/log.c index fd056b14e..f6aaa0415 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -324,6 +324,9 @@ void init_log_while_suspended(int log_while_suspended) void init_syslog(int facility) { + if (getenv("LVM_SUPPRESS_SYSLOG")) + return; + openlog("lvm", LOG_PID, facility); _syslog = 1; } |