From 3f014a2abf9e6e5e065300a002797090141bc331 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Mon, 25 Feb 2019 12:19:51 -0800 Subject: [PATCH] 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 --- fs_mgr/fs_mgr_overlayfs.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp index 9364b2df6..3d5062c4a 100644 --- a/fs_mgr/fs_mgr_overlayfs.cpp +++ b/fs_mgr/fs_mgr_overlayfs.cpp @@ -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; }