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

Commit 94da8944 authored by Yifan Hong's avatar Yifan Hong
Browse files

libsnapshot: UnmapSnapshot: don't delete device that doesn't exist.

Otherwise, DeleteDevice will just return false and it will
be stuck here.

Test: apply OTA after first boot, update_engine can unmap system_b
Bug: 135752105

Change-Id: If2b00336f4b948ba5f57a5e129fc070a739848fa
parent b278e013
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -313,7 +313,8 @@ bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) {
    // There may be an extra device, since the kernel doesn't let us have a
    // snapshot and linear target in the same table.
    auto dm_name = GetSnapshotDeviceName(name, status);
    if (name != dm_name && !dm.DeleteDevice(dm_name)) {
    if (name != dm_name && dm.GetState(dm_name) != DmDeviceState::INVALID &&
        !dm.DeleteDevice(dm_name)) {
        LOG(ERROR) << "Could not delete inner snapshot device: " << dm_name;
        return false;
    }