2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 15:25:22 +00:00

vlog: reopen log file in monitor process

ovs daemon process will reopen file after every log rotate.
However, it doesn't happen to monitor process. That is to say,
fd of log file in monitor proces always point to oldest disk file,
which is deleted after log rotate. Once daemon process restarts
from a crash, it inherits parent's fds, including the deleted log file.

This commit reopens log file in monitor process everytime it
wakes up from waitpid.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Huanle Han
2017-08-02 10:08:15 -04:00
committed by Ben Pfaff
parent 1e30f5fa96
commit 8ee4583645

View File

@@ -361,11 +361,14 @@ monitor_daemon(pid_t daemon_pid)
(unsigned long int) daemon_pid, status_msg);
if (child_ready) {
int error;
do {
retval = waitpid(daemon_pid, &status, 0);
} while (retval == -1 && errno == EINTR);
if (retval == -1) {
VLOG_FATAL("waitpid failed (%s)", ovs_strerror(errno));
error = retval == -1 ? errno : 0;
} while (error == EINTR);
vlog_reopen_log_file();
if (error) {
VLOG_FATAL("waitpid failed (%s)", ovs_strerror(error));
}
}