Loading fs_mgr/libsnapshot/snapshot.cpp +15 −17 Original line number Diff line number Diff line Loading @@ -668,10 +668,16 @@ bool SnapshotManager::MapSourceDevice(LockedFile* lock, const std::string& name, bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) { CHECK(lock); if (UpdateUsesUserSnapshots(lock)) { if (!UnmapUserspaceSnapshotDevice(lock, name)) { return false; } } else { if (!DeleteDeviceIfExists(name)) { LOG(ERROR) << "Could not delete snapshot device: " << name; return false; } } return true; } Loading Loading @@ -2429,11 +2435,9 @@ bool SnapshotManager::UnmapPartitionWithSnapshot(LockedFile* lock, const std::string& target_partition_name) { CHECK(lock); if (!UpdateUsesUserSnapshots(lock)) { if (!UnmapSnapshot(lock, target_partition_name)) { return false; } } if (!UnmapCowDevices(lock, target_partition_name)) { return false; Loading Loading @@ -2530,18 +2534,12 @@ bool SnapshotManager::UnmapCowDevices(LockedFile* lock, const std::string& name) CHECK(lock); if (!EnsureImageManager()) return false; if (UpdateUsesCompression(lock)) { if (UpdateUsesUserSnapshots(lock)) { if (!UnmapUserspaceSnapshotDevice(lock, name)) { return false; } } else { if (UpdateUsesCompression(lock) && !UpdateUsesUserSnapshots(lock)) { auto dm_user_name = GetDmUserCowName(name, GetSnapshotDriver(lock)); if (!UnmapDmUserDevice(dm_user_name)) { return false; } } } if (!DeleteDeviceIfExists(GetCowName(name), 4000ms)) { LOG(ERROR) << "Cannot unmap: " << GetCowName(name); Loading fs_mgr/libsnapshot/snapshot_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -897,9 +897,9 @@ class SnapshotUpdateTest : public SnapshotTest { ASSERT_NE(nullptr, metadata); ASSERT_TRUE(UpdatePartitionTable(*opener_, "super", *metadata.get(), 0)); // Map source partitions. Additionally, map sys_b to simulate system_other after flashing. // Map source partitions. std::string path; for (const auto& name : {"sys_a", "vnd_a", "prd_a", "sys_b"}) { for (const auto& name : {"sys_a", "vnd_a", "prd_a"}) { ASSERT_TRUE(CreateLogicalPartition( CreateLogicalPartitionParams{ .block_device = fake_super, Loading Loading
fs_mgr/libsnapshot/snapshot.cpp +15 −17 Original line number Diff line number Diff line Loading @@ -668,10 +668,16 @@ bool SnapshotManager::MapSourceDevice(LockedFile* lock, const std::string& name, bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) { CHECK(lock); if (UpdateUsesUserSnapshots(lock)) { if (!UnmapUserspaceSnapshotDevice(lock, name)) { return false; } } else { if (!DeleteDeviceIfExists(name)) { LOG(ERROR) << "Could not delete snapshot device: " << name; return false; } } return true; } Loading Loading @@ -2429,11 +2435,9 @@ bool SnapshotManager::UnmapPartitionWithSnapshot(LockedFile* lock, const std::string& target_partition_name) { CHECK(lock); if (!UpdateUsesUserSnapshots(lock)) { if (!UnmapSnapshot(lock, target_partition_name)) { return false; } } if (!UnmapCowDevices(lock, target_partition_name)) { return false; Loading Loading @@ -2530,18 +2534,12 @@ bool SnapshotManager::UnmapCowDevices(LockedFile* lock, const std::string& name) CHECK(lock); if (!EnsureImageManager()) return false; if (UpdateUsesCompression(lock)) { if (UpdateUsesUserSnapshots(lock)) { if (!UnmapUserspaceSnapshotDevice(lock, name)) { return false; } } else { if (UpdateUsesCompression(lock) && !UpdateUsesUserSnapshots(lock)) { auto dm_user_name = GetDmUserCowName(name, GetSnapshotDriver(lock)); if (!UnmapDmUserDevice(dm_user_name)) { return false; } } } if (!DeleteDeviceIfExists(GetCowName(name), 4000ms)) { LOG(ERROR) << "Cannot unmap: " << GetCowName(name); Loading
fs_mgr/libsnapshot/snapshot_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -897,9 +897,9 @@ class SnapshotUpdateTest : public SnapshotTest { ASSERT_NE(nullptr, metadata); ASSERT_TRUE(UpdatePartitionTable(*opener_, "super", *metadata.get(), 0)); // Map source partitions. Additionally, map sys_b to simulate system_other after flashing. // Map source partitions. std::string path; for (const auto& name : {"sys_a", "vnd_a", "prd_a", "sys_b"}) { for (const auto& name : {"sys_a", "vnd_a", "prd_a"}) { ASSERT_TRUE(CreateLogicalPartition( CreateLogicalPartitionParams{ .block_device = fake_super, Loading