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

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

fs_mgr_overlayfs_mount_fstab_entry(): Rename source device name

adb-remount-test.sh would fail if a overlayfs named "overlay" is mounted
in first_stage_init via fs_mgr_overlayfs_mount_fstab_entry():

  [  FAILED  ] overlay takeover unexpected at this phase

Prepend the source device name with "overlay-", so that the overlayfs
mounted by fs_mgr_overlayfs_mount_fstab_entry() mustn't be named
"overlay".

Bug: 188862155
Test: adb-remount-test.sh
Change-Id: Ia0b3f1c92ed5650c3e584fba23758344a4733657
Merged-In: Ia0b3f1c92ed5650c3e584fba23758344a4733657
(cherry picked from commit 7b90e693)
parent 94d1f3b4
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1310,13 +1310,15 @@ bool fs_mgr_overlayfs_mount_fstab_entry(const android::fs_mgr::FstabEntry& entry
        options += ",override_creds=off";
    }

    // Use .blk_device as the mount() source for debugging purposes.
    // Overlayfs is pseudo filesystem, so the source device is a symbolic value and isn't used to
    // back the filesystem. /proc/mounts would show the source as the device name of the mount.
    auto report = "__mount(source=" + entry.blk_device + ",target=" + entry.mount_point +
                  ",type=overlay," + options + ")=";
    auto ret = mount(entry.blk_device.c_str(), entry.mount_point.c_str(), "overlay",
                     MS_RDONLY | MS_NOATIME, options.c_str());
    // Use "overlay-" + entry.blk_device as the mount() source, so that adb-remout-test don't
    // confuse this with adb remount overlay, whose device name is "overlay".
    // Overlayfs is a pseudo filesystem, so the source device is a symbolic value and isn't used to
    // back the filesystem. However the device name would be shown in /proc/mounts.
    auto source = "overlay-" + entry.blk_device;
    auto report = "__mount(source=" + source + ",target=" + entry.mount_point + ",type=overlay," +
                  options + ")=";
    auto ret = mount(source.c_str(), entry.mount_point.c_str(), "overlay", MS_RDONLY | MS_NOATIME,
                     options.c_str());
    if (ret) {
        PERROR << report << ret;
        return false;