fs_mgr: overlayfs: system as root can not detect shared blocks (taimen)

init first stage manufactures a / mount pointing to /dev/root and
we can not use that for checking the filesystem.  Result is /system
overlay is mounted in second stage.

This adjustment to special case /dev/root is safe for overlayfs
handling because we will also gate on content in
/mnt/scratch/overlay/system, which will not be set during runtime
setup because check will have the proper block device at that time.

Test: adb-remount-test.sh
Bug: 123079041
Change-Id: I9c6674163955155f26ad2b0c9b78e9ff6507a514
This commit is contained in:
Mark Salyzyn 2019-02-25 12:19:51 -08:00
parent 61b2016881
commit 3f014a2abf

View file

@ -157,7 +157,12 @@ bool fs_mgr_overlayfs_enabled(FstabEntry* entry) {
fs_mgr_update_logical_partition(entry);
}
auto save_errno = errno;
errno = 0;
auto has_shared_blocks = fs_mgr_has_shared_blocks(entry->mount_point, entry->blk_device);
// special case for first stage init for system as root (taimen)
if (!has_shared_blocks && (errno == ENOENT) && (entry->blk_device == "/dev/root")) {
has_shared_blocks = true;
}
errno = save_errno;
return has_shared_blocks;
}