From 15b4427b9a9fc8b1162df8b728731dbcedfa94b5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 16 Oct 2021 07:58:44 -0600 Subject: [PATCH] No need to flush logs before commit point if we flush after each write. Also document that logs are flushed before sending a commit point even when flushing is disabled. --- doc/sudo_logsrvd.conf.man.in | 4 +++- doc/sudo_logsrvd.conf.mdoc.in | 4 +++- logsrvd/logsrvd.c | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/sudo_logsrvd.conf.man.in b/doc/sudo_logsrvd.conf.man.in index 319c3b5f8..592e99866 100644 --- a/doc/sudo_logsrvd.conf.man.in +++ b/doc/sudo_logsrvd.conf.man.in @@ -16,7 +16,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.TH "SUDO_LOGSRVD.CONF" "@mansectform@" "August 3, 2021" "Sudo @PACKAGE_VERSION@" "File Formats Manual" +.TH "SUDO_LOGSRVD.CONF" "@mansectform@" "October 16, 2021" "Sudo @PACKAGE_VERSION@" "File Formats Manual" .nh .if n .ad l .SH "NAME" @@ -550,6 +550,8 @@ buffering it. This makes it possible to view the logs in real-time as the program is executing but may significantly reduce the effectiveness of I/O log compression. +I/O logs are always flushed before sending a commit point to the client +regardless of this setting. The default value is \fRtrue\fR. .TP 10n diff --git a/doc/sudo_logsrvd.conf.mdoc.in b/doc/sudo_logsrvd.conf.mdoc.in index 1b85c7052..1d43a34ad 100644 --- a/doc/sudo_logsrvd.conf.mdoc.in +++ b/doc/sudo_logsrvd.conf.mdoc.in @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd August 3, 2021 +.Dd October 16, 2021 .Dt SUDO_LOGSRVD.CONF @mansectform@ .Os Sudo @PACKAGE_VERSION@ .Sh NAME @@ -486,6 +486,8 @@ buffering it. This makes it possible to view the logs in real-time as the program is executing but may significantly reduce the effectiveness of I/O log compression. +I/O logs are always flushed before sending a commit point to the client +regardless of this setting. The default value is .Li true . .It iolog_group = name diff --git a/logsrvd/logsrvd.c b/logsrvd/logsrvd.c index 6bcc708f4..c804825c5 100644 --- a/logsrvd/logsrvd.c +++ b/logsrvd/logsrvd.c @@ -1164,7 +1164,10 @@ server_commit_cb(int unused, int what, void *v) commit_point.tv_nsec = closure->elapsed_time.tv_nsec; if (!schedule_commit_point(&commit_point, closure)) connection_close(closure); - iolog_flush_all(closure); + + /* Flush I/O logs before sending commit point if needed. */ + if (!iolog_get_flush()) + iolog_flush_all(closure); debug_return; }