Loading fs_mgr/libsnapshot/scratch_super.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ using namespace android::storage_literals; namespace android { namespace snapshot { static bool UmountScratch() { bool UmountScratch(const bool cleanup_ota_dir) { Fstab fstab; if (!ReadFstabFromProcMounts(&fstab)) { LOG(ERROR) << "Cannot read /proc/mounts"; Loading @@ -72,11 +72,13 @@ static bool UmountScratch() { auto ota_dir = std::string(kOtaMetadataMount) + "/" + "ota"; if (cleanup_ota_dir) { std::error_code ec; if (std::filesystem::remove_all(ota_dir, ec) == static_cast<std::uintmax_t>(-1)) { LOG(ERROR) << "Failed to remove OTA directory: " << ec.message(); return false; } } if (umount(kOtaMetadataMount) != 0) { PLOG(ERROR) << "UmountScratch failed"; Loading @@ -88,7 +90,7 @@ static bool UmountScratch() { } bool CleanupScratchOtaMetadataIfPresent(const ISnapshotManager::IDeviceInfo* info) { if (!UmountScratch()) { if (!UmountScratch(true)) { return false; } Loading fs_mgr/libsnapshot/scratch_super.h +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ std::string GetScratchOtaMetadataPartition(); std::string MapScratchOtaMetadataPartition(const std::string& device); bool CreateScratchOtaMetadataOnSuper(const ISnapshotManager::IDeviceInfo* info = nullptr); bool CleanupScratchOtaMetadataIfPresent(const ISnapshotManager::IDeviceInfo* info = nullptr); bool UmountScratch(const bool cleanup_ota_dir); } // namespace snapshot } // namespace android fs_mgr/libsnapshot/snapshotctl.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -281,6 +281,8 @@ bool MapSnapshots::GetCowDevicePath(std::string partition_name, std::string* cow } bool MapSnapshots::ApplyUpdate() { auto scope_guard = android::base::make_scope_guard([]() { UmountScratch(false); }); if (!PrepareUpdate()) { LOG(ERROR) << "PrepareUpdate failed"; return false; Loading Loading
fs_mgr/libsnapshot/scratch_super.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ using namespace android::storage_literals; namespace android { namespace snapshot { static bool UmountScratch() { bool UmountScratch(const bool cleanup_ota_dir) { Fstab fstab; if (!ReadFstabFromProcMounts(&fstab)) { LOG(ERROR) << "Cannot read /proc/mounts"; Loading @@ -72,11 +72,13 @@ static bool UmountScratch() { auto ota_dir = std::string(kOtaMetadataMount) + "/" + "ota"; if (cleanup_ota_dir) { std::error_code ec; if (std::filesystem::remove_all(ota_dir, ec) == static_cast<std::uintmax_t>(-1)) { LOG(ERROR) << "Failed to remove OTA directory: " << ec.message(); return false; } } if (umount(kOtaMetadataMount) != 0) { PLOG(ERROR) << "UmountScratch failed"; Loading @@ -88,7 +90,7 @@ static bool UmountScratch() { } bool CleanupScratchOtaMetadataIfPresent(const ISnapshotManager::IDeviceInfo* info) { if (!UmountScratch()) { if (!UmountScratch(true)) { return false; } Loading
fs_mgr/libsnapshot/scratch_super.h +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ std::string GetScratchOtaMetadataPartition(); std::string MapScratchOtaMetadataPartition(const std::string& device); bool CreateScratchOtaMetadataOnSuper(const ISnapshotManager::IDeviceInfo* info = nullptr); bool CleanupScratchOtaMetadataIfPresent(const ISnapshotManager::IDeviceInfo* info = nullptr); bool UmountScratch(const bool cleanup_ota_dir); } // namespace snapshot } // namespace android
fs_mgr/libsnapshot/snapshotctl.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -281,6 +281,8 @@ bool MapSnapshots::GetCowDevicePath(std::string partition_name, std::string* cow } bool MapSnapshots::ApplyUpdate() { auto scope_guard = android::base::make_scope_guard([]() { UmountScratch(false); }); if (!PrepareUpdate()) { LOG(ERROR) << "PrepareUpdate failed"; return false; Loading