[systemd-devel] [PATCH] main: sync() before freeze()
Tom Gundersen
teg at jklm.no
Tue Dec 28 15:12:11 PST 2010
Avoids data loss when systemd freezes and a hard-reset is required.
---
src/main.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/main.c b/src/main.c
index 99e277c..82c8ddb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -169,6 +169,7 @@ _noreturn_ static void crash(int sig) {
log_info("Successfully spawned crash shall as pid %lu.", (unsigned long) pid);
}
+ sync();
log_info("Freezing execution.");
freeze();
}
@@ -1297,8 +1298,10 @@ finish:
log_error("Failed to execute shutdown binary, freezing: %m");
}
- if (getpid() == 1)
+ if (getpid() == 1) {
+ sync();
freeze();
+ }
return retval;
}
--
1.7.3.4
More information about the systemd-devel
mailing list