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.
Version 2.03.02 -
===================================
+ Introduce LVM_SUPPRESS_SYSLOG to suppress syslog usage by generator.
Fix generator quering lvmconfig unpresent config option.
Fix memleak on bcache error path code.
Fix missing unlock on lvm2 dmeventd plugin error path initialization.
void init_syslog(int facility)
{
+ if (getenv("LVM_SUPPRESS_SYSLOG"))
+ return;
+
openlog("lvm", LOG_PID, facility);
_syslog = 1;
}
.B LVM_SUPPRESS_FD_WARNINGS
Suppress warnings about unexpected file descriptors passed into LVM.
.TP
+.B LVM_SUPPRESS_SYSLOG
+Suppress contacting syslog.
+.TP
.B LVM_VG_NAME
The Volume Group name that is assumed for
any reference to a Logical Volume that doesn't specify a path.
(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.