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

Commit 29b30cba authored by Alessio Balsini's avatar Alessio Balsini Committed by android-build-merger
Browse files

Merge "libsnapshot: use DeleteDeviceIfExists() when required"

am: f8d80b7d

Change-Id: I1a8f2509fd8390e5656b09a3ac1c6dc16bf4c11e
parents 1f3a8c4f f8d80b7d
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) {
    }

    auto& dm = DeviceMapper::Instance();
    if (dm.GetState(name) != DmDeviceState::INVALID && !dm.DeleteDevice(name)) {
    if (!dm.DeleteDeviceIfExists(name)) {
        LOG(ERROR) << "Could not delete snapshot device: " << name;
        return false;
    }
@@ -345,8 +345,7 @@ 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.GetState(dm_name) != DmDeviceState::INVALID &&
        !dm.DeleteDevice(dm_name)) {
    if (name != dm_name && !dm.DeleteDeviceIfExists(dm_name)) {
        LOG(ERROR) << "Could not delete inner snapshot device: " << dm_name;
        return false;
    }
@@ -898,7 +897,7 @@ bool SnapshotManager::CollapseSnapshotDevice(const std::string& name,
        // the device, and device-mapper should have flushed remaining I/O. We
        // could in theory replace with dm-zero (or re-use the table above), but
        // for now it's better to know why this would fail.
        if (!dm.DeleteDevice(dm_name)) {
        if (!dm.DeleteDeviceIfExists(dm_name)) {
            LOG(ERROR) << "Unable to delete snapshot device " << dm_name << ", COW cannot be "
                       << "reclaimed until after reboot.";
            return false;