diff --git a/fastboot/device/utility.cpp b/fastboot/device/utility.cpp index 2ebd57d12..e01e39b39 100644 --- a/fastboot/device/utility.cpp +++ b/fastboot/device/utility.cpp @@ -61,7 +61,7 @@ bool OpenLogicalPartition(FastbootDevice* device, const std::string& partition_n LOG(ERROR) << "Could not map partition: " << partition_name; return false; } - auto closer = [partition_name]() -> void { DestroyLogicalPartition(partition_name, 5s); }; + auto closer = [partition_name]() -> void { DestroyLogicalPartition(partition_name); }; *handle = PartitionHandle(dm_path, std::move(closer)); return true; } diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 259f80076..7a0d019ad 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -1331,7 +1331,7 @@ int fs_mgr_umount_all(android::fs_mgr::Fstab* fstab) { continue; } } else if ((current_entry.fs_mgr_flags.verify)) { - if (!fs_mgr_teardown_verity(¤t_entry, true /* wait */)) { + if (!fs_mgr_teardown_verity(¤t_entry)) { LERROR << "Failed to tear down verified partition on mount point: " << current_entry.mount_point; ret |= FsMgrUmountStatus::ERROR_VERITY; diff --git a/fs_mgr/fs_mgr_dm_linear.cpp b/fs_mgr/fs_mgr_dm_linear.cpp index cd089dc84..04ba0bf9c 100644 --- a/fs_mgr/fs_mgr_dm_linear.cpp +++ b/fs_mgr/fs_mgr_dm_linear.cpp @@ -184,24 +184,16 @@ bool CreateLogicalPartition(const std::string& block_device, uint32_t metadata_s timeout_ms, path); } -bool UnmapDevice(const std::string& name, const std::chrono::milliseconds& timeout_ms) { +bool UnmapDevice(const std::string& name) { DeviceMapper& dm = DeviceMapper::Instance(); - std::string path; - if (timeout_ms > std::chrono::milliseconds::zero()) { - dm.GetDmDevicePathByName(name, &path); - } if (!dm.DeleteDevice(name)) { return false; } - if (!path.empty() && !WaitForFileDeleted(path, timeout_ms)) { - LERROR << "Timed out waiting for device path to unlink: " << path; - return false; - } return true; } -bool DestroyLogicalPartition(const std::string& name, const std::chrono::milliseconds& timeout_ms) { - if (!UnmapDevice(name, timeout_ms)) { +bool DestroyLogicalPartition(const std::string& name) { + if (!UnmapDevice(name)) { return false; } LINFO << "Unmapped logical partition " << name; diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp index 05ca5fc33..a525bd5ca 100644 --- a/fs_mgr/fs_mgr_overlayfs.cpp +++ b/fs_mgr/fs_mgr_overlayfs.cpp @@ -445,7 +445,7 @@ bool fs_mgr_overlayfs_teardown_scratch(const std::string& overlay, bool* change) auto metadata = builder->Export(); if (metadata && UpdatePartitionTable(super_device, *metadata.get(), slot_number)) { if (change) *change = true; - if (!DestroyLogicalPartition(partition_name, 0s)) return false; + if (!DestroyLogicalPartition(partition_name)) return false; } else { LERROR << "delete partition " << overlay; return false; @@ -663,7 +663,7 @@ static void TruncatePartitionsWithSuffix(MetadataBuilder* builder, const std::st if (!android::base::EndsWith(name, suffix)) { continue; } - if (dm.GetState(name) != DmDeviceState::INVALID && !DestroyLogicalPartition(name, 2s)) { + if (dm.GetState(name) != DmDeviceState::INVALID && !DestroyLogicalPartition(name)) { continue; } builder->ResizePartition(builder->FindPartition(name), 0); @@ -737,7 +737,7 @@ bool fs_mgr_overlayfs_create_scratch(const Fstab& fstab, std::string* scratch_de return false; } } - if (!partition_create) DestroyLogicalPartition(partition_name, 10s); + if (!partition_create) DestroyLogicalPartition(partition_name); changed = true; *partition_exists = false; } diff --git a/fs_mgr/fs_mgr_priv.h b/fs_mgr/fs_mgr_priv.h index 3a33cf3f3..c5e477cff 100644 --- a/fs_mgr/fs_mgr_priv.h +++ b/fs_mgr/fs_mgr_priv.h @@ -97,10 +97,10 @@ bool is_dt_compatible(); bool fs_mgr_is_ext4(const std::string& blk_device); bool fs_mgr_is_f2fs(const std::string& blk_device); -bool fs_mgr_teardown_verity(android::fs_mgr::FstabEntry* fstab, bool wait); +bool fs_mgr_teardown_verity(android::fs_mgr::FstabEntry* fstab); namespace android { namespace fs_mgr { -bool UnmapDevice(const std::string& name, const std::chrono::milliseconds& timeout_ms); +bool UnmapDevice(const std::string& name); } // namespace fs_mgr } // namespace android diff --git a/fs_mgr/fs_mgr_verity.cpp b/fs_mgr/fs_mgr_verity.cpp index be8077b8c..efa218078 100644 --- a/fs_mgr/fs_mgr_verity.cpp +++ b/fs_mgr/fs_mgr_verity.cpp @@ -547,9 +547,9 @@ out: return retval; } -bool fs_mgr_teardown_verity(FstabEntry* entry, bool wait) { +bool fs_mgr_teardown_verity(FstabEntry* entry) { const std::string mount_point(basename(entry->mount_point.c_str())); - if (!android::fs_mgr::UnmapDevice(mount_point, wait ? 1000ms : 0ms)) { + if (!android::fs_mgr::UnmapDevice(mount_point)) { return false; } LINFO << "Unmapped verity device " << mount_point; diff --git a/fs_mgr/include/fs_mgr_dm_linear.h b/fs_mgr/include/fs_mgr_dm_linear.h index f33fc028b..a1dc2dc95 100644 --- a/fs_mgr/include/fs_mgr_dm_linear.h +++ b/fs_mgr/include/fs_mgr_dm_linear.h @@ -68,7 +68,7 @@ bool CreateLogicalPartition(const std::string& block_device, const LpMetadata& m // Destroy the block device for a logical partition, by name. If |timeout_ms| // is non-zero, then this will block until the device path has been unlinked. -bool DestroyLogicalPartition(const std::string& name, const std::chrono::milliseconds& timeout_ms); +bool DestroyLogicalPartition(const std::string& name); } // namespace fs_mgr } // namespace android