From 43cac49092ec99802d74b1d6279d4d27a4048829 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 22 Oct 2021 16:37:10 +0200 Subject: [PATCH] process-util: move sync() out of freeze() We are using this for creating userns namespaces, and we really shouldn't try to sync there. Moreover the use of free() in shutdown code doesn't need it anyway, since it just sync()ed right before anyway. Only the third user of freeze() we have actually needs the syc(), hence do it there and nowhere else. --- src/basic/process-util.c | 2 -- src/core/main.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index fce96dd5ebd..38df34e3395 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -1624,8 +1624,6 @@ _noreturn_ void freeze(void) { /* Make sure nobody waits for us on a socket anymore */ (void) close_all_fds_full(NULL, 0, false); - sync(); - /* Let's not freeze right away, but keep reaping zombies. */ for (;;) { siginfo_t si = {}; diff --git a/src/core/main.c b/src/core/main.c index 6e01398523c..129f340f6e2 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -222,6 +222,7 @@ _noreturn_ static void freeze_or_exit_or_reboot(void) { } log_emergency("Freezing execution."); + sync(); freeze(); } -- 2.47.3