Skip to contentSkip to conversation

libext2fs: Fix fsync(2) detection

PATCH Applied Jan Kara 2 participants 2 messages Jun 7, 2017 – Jun 8, 2017 Library code

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 libext2fs: Fix fsync(2) detection

For some reason lib/config.h.in was missing a definition of HAVE_FSYNC and as a result lib/config.h never had HAVE_FSYNC defined. As a result we never called fsync(2) for example from lib/ext2fs/unix_io.c:unix_flush() when we finished creating filesystem and could miss IO errors happening during creating of the filesystem. Test generic/405 exposes this problem.

Fix the problem by defining HAVE_FSYNC in lib/config.h.in.

---
 lib/config.h.in | 3 +++
 1 file changed, 3 insertions(+)
lib/config.h.in +3 -0
index 37d0c461338a..91e869e7d3d7 100644
@@ -470,6 +470,9 @@
 /* Define to 1 if you have the `sync_file_range' function. */
 #undef HAVE_SYNC_FILE_RANGE
 
+/* Define to 1 if you have the 'fsync' function. */
+#undef HAVE_FSYNC
+
 /* Define to 1 if you have the `sysconf' function. */
 #undef HAVE_SYSCONF
 
Signature · 1 line
2.12.3
#1 lore raw
Quoted 10 lines · Jan Kara

For some reason lib/config.h.in was missing a definition of HAVE_FSYNC and as a result lib/config.h never had HAVE_FSYNC defined. As a result we never called fsync(2) for example from lib/ext2fs/unix_io.c:unix_flush() when we finished creating filesystem and could miss IO errors happening during creating of the filesystem. Test generic/405 exposes this problem.

Fix the problem by defining HAVE_FSYNC in lib/config.h.in.

Thanks for tracking down this regression. This bug was introduced by my cherry-picking in changes from the Android AOSP version of e2fsprogs a few weeks ago. I was wondering why generic/405 had regressed.

Thanks, applied.

- Ted