From c2f37683bc0e380c866a31ba6a05587b0f81d57e Mon Sep 17 00:00:00 2001 From: Paul Crowley Date: Wed, 20 May 2020 16:36:15 -0700 Subject: [PATCH] emmc_optimized means stable_inodes If the emmc_optimized filesystem flag is set, then like inlinecrypt_optimized, we have to ensure that stable_inodes is set on the filesystem. Bug: 144046242 Test: Cuttlefish, ext4: set the flag in fstab, check for the stable_inodes flag using tunefs -l Change-Id: Id7f906564457c240ddf6677dd536698881385385 --- fs_mgr/fs_mgr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index d2daaa197..8c2e00107 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -454,7 +454,8 @@ static void tune_encrypt(const std::string& blk_device, const FstabEntry& entry, << entry.encryption_options; return; } - if ((options.flags & FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64) != 0) { + if ((options.flags & + (FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 | FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32)) != 0) { // We can only use this policy on ext4 if the "stable_inodes" feature // is set on the filesystem, otherwise shrinking will break encrypted files. if ((sb->s_feature_compat & cpu_to_le32(EXT4_FEATURE_COMPAT_STABLE_INODES)) == 0) {