Message ID | 20200214175429.26111-4-anton.ivanov@cambridgegreys.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev,v2,1/4] Replace direct use of POLLXXX macros with OVS_POLLXXX | expand |
Bleep bloop. Greetings Anton Ivanov, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: Line has trailing whitespace #31 FILE: lib/vlog.c:1093: /* Quickly exit without contending the log mutex if the module log Lines checked: 48, Warnings: 1, Errors: 0 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
diff --git a/lib/vlog.c b/lib/vlog.c index 559943d87..be28b59a1 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -1088,10 +1088,19 @@ vlog_valist(const struct vlog_module *module, enum vlog_level level, { bool log_to_console = module->levels[VLF_CONSOLE] >= level; bool log_to_syslog = module->levels[VLF_SYSLOG] >= level; - bool log_to_file; + bool log_to_file = module->levels[VLF_FILE] >= level; + + /* Quickly exit without contending the log mutex if the module log + * levels do not request any logging to start off with. + */ + + if (!(log_to_console || log_to_syslog || log_to_file)) { + return; + } ovs_mutex_lock(&log_file_mutex); - log_to_file = module->levels[VLF_FILE] >= level && log_fd >= 0; + /* check only log_fd under mutex */ + log_to_file &= (log_fd >= 0); ovs_mutex_unlock(&log_file_mutex); if (log_to_console || log_to_syslog || log_to_file) { int save_errno = errno;