08c3a6
commit b5032c3d37aa614644c7afbad33bb8226a52e6da
08c3a6
Author: Florian Weimer <fweimer@redhat.com>
08c3a6
Date:   Mon Feb 28 11:50:41 2022 +0100
08c3a6
08c3a6
    io: Add fsync call in tst-stat
08c3a6
    
08c3a6
    io/tst-stat and io/tst-stat-lfs fail sporadically on the Fedora
08c3a6
    builders, and this change hopefully helps to avoid the issue.
08c3a6
    
08c3a6
    (cherry picked from commit ae132284092edc5885315b44cd17d5ea91177e49)
08c3a6
08c3a6
diff --git a/io/tst-stat.c b/io/tst-stat.c
08c3a6
index 82e965de6ad87f61..be20cf16d70d05cc 100644
08c3a6
--- a/io/tst-stat.c
08c3a6
+++ b/io/tst-stat.c
08c3a6
@@ -69,6 +69,10 @@ do_test (void)
08c3a6
   TEST_VERIFY_EXIT (fd >= 0);
08c3a6
   support_write_file_string (path, "abc");
08c3a6
 
08c3a6
+  /* This should help to prevent delayed allocation, which may result
08c3a6
+     in a spurious stx_blocks/st_blocks difference.  */
08c3a6
+  fsync (fd);
08c3a6
+
08c3a6
   bool check_ns = support_stat_nanoseconds (path);
08c3a6
   if (!check_ns)
08c3a6
     printf ("warning: timestamp with nanoseconds not supported\n");