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

Commit 3a22c9e1 authored by Yi-Yo Chiang's avatar Yi-Yo Chiang
Browse files

fs_mgr_overlayfs: MapScratchPartitionIfNeeded always tries to create scratch

Simplify the logic of MapScratchPartitionIfNeeded to just map the
scratch partition unconditionally. If there is a "scratch" logical
partition available, we just assume it must be needed later to
facilitate overlayfs.

Going through the fstab & fs_mgr_overlayfs_candidate_list to determine
if overlayfs is needed or not might be inaccurate as the fstab passed into
MapScratchPartitionIfNeeded is incomplete (it includes only the
"first_stage_mount" entries). So the scratch device might not get created
even though there are some "late mount" partitions that need the scratch
device to facilitate overlayfs.

Bug: 306124139
Test: adb-remount-test
Change-Id: I8590750e822219dec3d7d3c8648e9c9a5a32f68c
parent 455fb82b
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -854,21 +854,6 @@ void MapScratchPartitionIfNeeded(Fstab* fstab,
        return;
    }

    bool want_scratch = false;
    for (const auto& entry : fs_mgr_overlayfs_candidate_list(*fstab)) {
        if (fs_mgr_is_verity_enabled(entry)) {
            continue;
        }
        if (fs_mgr_overlayfs_already_mounted(fs_mgr_mount_point(entry.mount_point))) {
            continue;
        }
        want_scratch = true;
        break;
    }
    if (!want_scratch) {
        return;
    }

    if (ScratchIsOnData()) {
        if (auto images = IImageManager::Open("remount", 0ms)) {
            images->MapAllImages(init);