Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 648f4d08 authored by David Anderson's avatar David Anderson Committed by Automerger Merge Worker
Browse files

Merge changes I350c8c88,I1e462fad am: 6c31ab7a am: d22ff3b3 am: e086ba0c

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1911212

Change-Id: I450e9bd44f29d69ab632ac10fb7ce81333e4321a
parents d8d302c4 e086ba0c
Loading
Loading
Loading
Loading
+15 −17
Original line number Original line Diff line number Diff line
@@ -668,10 +668,16 @@ bool SnapshotManager::MapSourceDevice(LockedFile* lock, const std::string& name,
bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) {
bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) {
    CHECK(lock);
    CHECK(lock);


    if (UpdateUsesUserSnapshots(lock)) {
        if (!UnmapUserspaceSnapshotDevice(lock, name)) {
            return false;
        }
    } else {
        if (!DeleteDeviceIfExists(name)) {
        if (!DeleteDeviceIfExists(name)) {
            LOG(ERROR) << "Could not delete snapshot device: " << name;
            LOG(ERROR) << "Could not delete snapshot device: " << name;
            return false;
            return false;
        }
        }
    }
    return true;
    return true;
}
}


@@ -2429,11 +2435,9 @@ bool SnapshotManager::UnmapPartitionWithSnapshot(LockedFile* lock,
                                                 const std::string& target_partition_name) {
                                                 const std::string& target_partition_name) {
    CHECK(lock);
    CHECK(lock);


    if (!UpdateUsesUserSnapshots(lock)) {
    if (!UnmapSnapshot(lock, target_partition_name)) {
    if (!UnmapSnapshot(lock, target_partition_name)) {
        return false;
        return false;
    }
    }
    }


    if (!UnmapCowDevices(lock, target_partition_name)) {
    if (!UnmapCowDevices(lock, target_partition_name)) {
        return false;
        return false;
@@ -2530,18 +2534,12 @@ bool SnapshotManager::UnmapCowDevices(LockedFile* lock, const std::string& name)
    CHECK(lock);
    CHECK(lock);
    if (!EnsureImageManager()) return false;
    if (!EnsureImageManager()) return false;


    if (UpdateUsesCompression(lock)) {
    if (UpdateUsesCompression(lock) && !UpdateUsesUserSnapshots(lock)) {
        if (UpdateUsesUserSnapshots(lock)) {
            if (!UnmapUserspaceSnapshotDevice(lock, name)) {
                return false;
            }
        } else {
        auto dm_user_name = GetDmUserCowName(name, GetSnapshotDriver(lock));
        auto dm_user_name = GetDmUserCowName(name, GetSnapshotDriver(lock));
        if (!UnmapDmUserDevice(dm_user_name)) {
        if (!UnmapDmUserDevice(dm_user_name)) {
            return false;
            return false;
        }
        }
    }
    }
    }


    if (!DeleteDeviceIfExists(GetCowName(name), 4000ms)) {
    if (!DeleteDeviceIfExists(GetCowName(name), 4000ms)) {
        LOG(ERROR) << "Cannot unmap: " << GetCowName(name);
        LOG(ERROR) << "Cannot unmap: " << GetCowName(name);
+2 −2
Original line number Original line Diff line number Diff line
@@ -897,9 +897,9 @@ class SnapshotUpdateTest : public SnapshotTest {
        ASSERT_NE(nullptr, metadata);
        ASSERT_NE(nullptr, metadata);
        ASSERT_TRUE(UpdatePartitionTable(*opener_, "super", *metadata.get(), 0));
        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;
        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(
            ASSERT_TRUE(CreateLogicalPartition(
                    CreateLogicalPartitionParams{
                    CreateLogicalPartitionParams{
                            .block_device = fake_super,
                            .block_device = fake_super,