Two phases to set the password for disk encryption
am: 92c5eeb467

* commit '92c5eeb46779f0fa1c9e6db6b0d632d960cbb2e4':
  Two phases to set the password for disk encryption

Change-Id: I82c1cfa2874ac4709e42f5c2047c832cbcaccb91
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index c214d54..a08fe39 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -178,6 +178,14 @@
     }
     LOG(DEBUG) << "Added key " << key_id << " (" << ref << ") to keyring " << device_keyring
                << " in process " << getpid();
+
+    // *TODO* Remove this code when kernel is fixed - see b/28373400
+    // Kernel preserves caches across a key insertion with ext4ice, which leads
+    // to contradictory dirents
+    if (!android::base::WriteStringToFile("3", "/proc/sys/vm/drop_caches")) {
+        PLOG(ERROR) << "Failed to drop_caches";
+    }
+
     return true;
 }