From bc28e389a7758c1450a90bf5290ba216d5ea1abe Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 22 Mar 2009 15:17:08 -0700 Subject: [PATCH 1/1] Add an fsync (Ted T'so would be pleased) We've been using open;write;close;rename for udpating mnemon files, but with recent discussion of ext4 failure modes, Ted has taught that the only reliable way of getting the desired results is to fsync before the close. That fsync does more than we really want here, but there's no way to ask for a less heavy version of what we want. --- mnemon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mnemon.c b/mnemon.c index db8f62f..5ce7364 100644 --- a/mnemon.c +++ b/mnemon.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -730,6 +731,7 @@ mnemon_save (mnemon_t *mnemon) category_print (category, file); + fsync (fileno (file)); fclose (file); err = rename (lock_filename, filename); -- 2.43.0