io: Add fsync call in tst-stat

Message ID 87leyrsxrr.fsf@oldenburg.str.redhat.com
State Committed
Commit ae132284092edc5885315b44cd17d5ea91177e49
Headers
Series io: Add fsync call in tst-stat |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Florian Weimer Feb. 3, 2022, 4:47 p.m. UTC
  io/tst-stat and io/tst-stat-lfs fail sporadically on the Fedora
builders, and this change hopefully helps to avoid the issue.

---
 io/tst-stat.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Patch

diff --git a/io/tst-stat.c b/io/tst-stat.c
index 2b7975e162..237988203a 100644
--- a/io/tst-stat.c
+++ b/io/tst-stat.c
@@ -69,6 +69,10 @@  do_test (void)
   TEST_VERIFY_EXIT (fd >= 0);
   support_write_file_string (path, "abc");
 
+  /* This should help to prevent delayed allocation, which may result
+     in a spurious stx_blocks/st_blocks difference.  */
+  fsync (fd);
+
   bool check_ns = support_stat_nanoseconds (path);
   if (!check_ns)
     printf ("warning: timestamp with nanoseconds not supported\n");