Skip to content

Commit

Permalink
logging: remove unuseful fsync
Browse files Browse the repository at this point in the history
the file is going to be removed few lines later with rename():

```
	/* Replace the previous file */
	if (rename(k8s_log_path_tmp, k8s_log_path) < 0) {
		pexit("Failed to rename log file");
	}
```

so there is no point in the expensive sync call since the file is not
supposed to be persisted after a reboot.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jul 4, 2024
1 parent 1578849 commit fca5822
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/ctr_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,6 @@ static void reopen_k8s_file(void)

_cleanup_free_ char *k8s_log_path_tmp = g_strdup_printf("%s.tmp", k8s_log_path);

/* Sync the logs to disk */
if (!opt_no_sync_log && fsync(k8s_log_fd) < 0) {
pwarn("Failed to sync log file on reopen");
}

/* Close the current k8s_log_fd */
close(k8s_log_fd);

Expand Down

0 comments on commit fca5822

Please sign in to comment.