Snap for 15063687 from c12903e918be48f1f3ff9687da7270463aa89658 to 26Q2-release Change-Id: Ib6c721d5f23d3ec175d01e4d0014679b92754cd7
diff --git a/Utils.cpp b/Utils.cpp index 1accd5c..a55a57e 100644 --- a/Utils.cpp +++ b/Utils.cpp
@@ -1994,21 +1994,5 @@ return result; } -std::chrono::seconds GetTimeoutForUntrustedStorage(const std::string& source, - UntrustedStorageTimeoutType type) { - uint64_t size_bytes = 0; - if (GetBlockDevSize(source, &size_bytes) != 0) { - PLOG(ERROR) << "Failed to get size of " << source; - } - bool is_large = size_bytes > kUntrustedStorageSizeThreshold; - - switch (type) { - case UntrustedStorageTimeoutType::kFsck: - return is_large ? kUntrustedFsckSleepTimeLarge : kUntrustedFsckSleepTime; - case UntrustedStorageTimeoutType::kMount: - return is_large ? kUntrustedMountSleepTimeLarge : kUntrustedMountSleepTime; - } -} - } // namespace vold } // namespace android
diff --git a/Utils.h b/Utils.h index 7f86e87..6d2a3ce 100644 --- a/Utils.h +++ b/Utils.h
@@ -38,17 +38,8 @@ static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled"; static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled"; -/* - * Threshold for untrusted external storage devices. - * For larger storage devices, use a relaxed timeout value for fsck and mount. - */ -static constexpr uint64_t kUntrustedStorageSizeThreshold = 512ULL * 1024 * 1024 * 1024; - static constexpr std::chrono::seconds kUntrustedFsckSleepTime(45); -static constexpr std::chrono::seconds kUntrustedFsckSleepTimeLarge(90); static constexpr std::chrono::seconds kUntrustedMountSleepTime(20); -static constexpr std::chrono::seconds kUntrustedMountSleepTimeLarge(40); - /* SELinux contexts used depending on the block device type */ extern char* sBlkidContext; @@ -232,14 +223,6 @@ status_t PrepareMountDirForUser(userid_t user_id); -enum class UntrustedStorageTimeoutType { - kFsck, - kMount, -}; - -std::chrono::seconds GetTimeoutForUntrustedStorage(const std::string& source, - UntrustedStorageTimeoutType type); - } // namespace vold } // namespace android
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp index 59b56cd..6444178 100644 --- a/fs/Exfat.cpp +++ b/fs/Exfat.cpp
@@ -44,9 +44,7 @@ cmd.push_back("-y"); cmd.push_back(source); - int rc = ForkExecvpTimeout( - cmd, GetTimeoutForUntrustedStorage(source, UntrustedStorageTimeoutType::kFsck), - sFsckUntrustedContext); + int rc = ForkExecvpTimeout(cmd, kUntrustedFsckSleepTime, sFsckUntrustedContext); if (rc == 0) { LOG(INFO) << "Check OK"; return 0; @@ -97,8 +95,7 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUid, int ownerGid, int permMask) { struct mount_args args = {source, target, ownerUid, ownerGid, permMask}; - return ForkTimeout(DoMountWrapper, &args, - GetTimeoutForUntrustedStorage(source, UntrustedStorageTimeoutType::kMount)); + return ForkTimeout(DoMountWrapper, &args, kUntrustedMountSleepTime); } status_t Format(const std::string& source) {
diff --git a/fs/Vfat.cpp b/fs/Vfat.cpp index a0de855..3bab02f 100644 --- a/fs/Vfat.cpp +++ b/fs/Vfat.cpp
@@ -69,9 +69,7 @@ cmd.push_back(source); // Fat devices are currently always untrusted - rc = ForkExecvpTimeout( - cmd, GetTimeoutForUntrustedStorage(source, UntrustedStorageTimeoutType::kFsck), - sFsckUntrustedContext); + rc = ForkExecvpTimeout(cmd, kUntrustedFsckSleepTime, sFsckUntrustedContext); if (rc < 0) { LOG(ERROR) << "Filesystem check failed due to fork error"; errno = EIO; @@ -223,9 +221,7 @@ bool executable, int ownerUid, int ownerGid, int permMask, bool createLost) { struct mount_args args = {source, target, ro, remount, executable, ownerUid, ownerGid, permMask, createLost}; - - return ForkTimeout(DoMountWrapper, &args, - GetTimeoutForUntrustedStorage(source, UntrustedStorageTimeoutType::kMount)); + return ForkTimeout(DoMountWrapper, &args, kUntrustedMountSleepTime); } status_t Format(const std::string& source, unsigned long numSectors) {