Merge changes I350c8c88,I1e462fad
* changes: libsnapshot: Fix unmapping getting skipped for userspace snapshots. libsnapshot: Don't map "b" partitions during testing.
This commit is contained in:
commit
6c31ab7a13
2 changed files with 17 additions and 19 deletions
|
|
@ -668,9 +668,15 @@ bool SnapshotManager::MapSourceDevice(LockedFile* lock, const std::string& name,
|
|||
bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) {
|
||||
CHECK(lock);
|
||||
|
||||
if (!DeleteDeviceIfExists(name)) {
|
||||
LOG(ERROR) << "Could not delete snapshot device: " << name;
|
||||
return false;
|
||||
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;
|
||||
}
|
||||
|
|
@ -2429,10 +2435,8 @@ 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 (!UnmapSnapshot(lock, target_partition_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!UnmapCowDevices(lock, target_partition_name)) {
|
||||
|
|
@ -2530,16 +2534,10 @@ 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 {
|
||||
auto dm_user_name = GetDmUserCowName(name, GetSnapshotDriver(lock));
|
||||
if (!UnmapDmUserDevice(dm_user_name)) {
|
||||
return false;
|
||||
}
|
||||
if (UpdateUsesCompression(lock) && !UpdateUsesUserSnapshots(lock)) {
|
||||
auto dm_user_name = GetDmUserCowName(name, GetSnapshotDriver(lock));
|
||||
if (!UnmapDmUserDevice(dm_user_name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Reference in a new issue