From 8ad0bef7b5b1b6e1ba3afe441d2dcc9a06e782a7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Thu, 20 Apr 2017 12:29:37 -0700 Subject: [PATCH] Revert "Stop dropping caches now we have kernel fix" This reverts commit 6abe6831b59a56145cdd28445cd46fa3c79ecb92. Bringing this back temporarily for the same issue on sdcardfs. Will remove once the kernel issue is resolved. Change-Id: Ia29ea4fddb7777012a2eea9259f9ac856773fe01 Bug: 37231161 Test: Boot device with FBE enabled. ls /storage/emulated/0/Android Unlock device. ls /storage/emulated/0/Android 1st will not be found. Second should be found. --- Ext4Crypt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp index 9dfcad8..88bedd0 100644 --- a/Ext4Crypt.cpp +++ b/Ext4Crypt.cpp @@ -171,6 +171,13 @@ static bool install_key(const std::string& key, std::string* raw_ref) { 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; }