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

Commit a171ef38 authored by Yifan Hong's avatar Yifan Hong
Browse files

libsnapshot: Return path if snapshot is already merged

If snapshot is already merged, MapUpdateSnapshot
will only map the base device, but it doesn't return
the path. Now, it returns the path of the base device as well.

Test: libsnapshot_test

Change-Id: Ic56bc1a624651f24185c52401a3a01e8942d5d57
parent 3699dbe2
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -1307,8 +1307,8 @@ bool SnapshotManager::MapPartitionWithSnapshot(LockedFile* lock,
    // device itself. This device consists of the real blocks in the super
    // device itself. This device consists of the real blocks in the super
    // partition that this logical partition occupies.
    // partition that this logical partition occupies.
    auto& dm = DeviceMapper::Instance();
    auto& dm = DeviceMapper::Instance();
    std::string ignore_path;
    std::string base_path;
    if (!CreateLogicalPartition(params, &ignore_path)) {
    if (!CreateLogicalPartition(params, &base_path)) {
        LOG(ERROR) << "Could not create logical partition " << params.GetPartitionName()
        LOG(ERROR) << "Could not create logical partition " << params.GetPartitionName()
                   << " as device " << params.GetDeviceName();
                   << " as device " << params.GetDeviceName();
        return false;
        return false;
@@ -1316,6 +1316,7 @@ bool SnapshotManager::MapPartitionWithSnapshot(LockedFile* lock,
    created_devices.EmplaceBack<AutoUnmapDevice>(&dm, params.GetDeviceName());
    created_devices.EmplaceBack<AutoUnmapDevice>(&dm, params.GetDeviceName());


    if (!live_snapshot_status.has_value()) {
    if (!live_snapshot_status.has_value()) {
        *path = base_path;
        created_devices.Release();
        created_devices.Release();
        return true;
        return true;
    }
    }