Fsync directories after creating files

Bug: 112145641
Bug: 124279741
Bug: 120248692
Test: adb shell locksettings set-pin 1111 && \
    adb shell "echo b > /proc/sysrq-trigger"
Change-Id: I53d252942c21365983b4f8b6e0948b1864f195c1
Merged-In: I53d252942c21365983b4f8b6e0948b1864f195c1
(cherry picked from commit 2e58acb4123e559fddfd4013af3ead6c055bd71c)
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 67b7e90..68439c0 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -177,6 +177,7 @@
             PLOG(WARNING) << "Unable to rename " << to_fix << " to " << current_path;
         }
     }
+    android::vold::FsyncDirectory(directory_path);
 }
 
 static bool read_and_fixate_user_ce_key(userid_t user_id,
@@ -569,6 +570,7 @@
     std::string ce_key_path;
     if (!get_ce_key_new_path(directory_path, paths, &ce_key_path)) return false;
     if (!android::vold::storeKeyAtomically(ce_key_path, user_key_temp, auth, ce_key)) return false;
+    if (!android::vold::FsyncDirectory(directory_path)) return false;
     return true;
 }