From b18aba0a9ffae61e5bc697f3a532eaab0d6a4161 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 2 Apr 2019 11:15:02 -0700 Subject: [PATCH] fs_mgr: remount: system is root For devices without overlayfs and system is root (Hikey, Hikey960) correct "/system" to "/" if that is the mount point. Test: adb-remount-test.sh Bug: 129720614 Change-Id: I3bdbd5ea7b70d03477055e60521d8132b486c904 --- fs_mgr/fs_mgr_remount.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs_mgr/fs_mgr_remount.cpp b/fs_mgr/fs_mgr_remount.cpp index 24044d873..093d44d41 100644 --- a/fs_mgr/fs_mgr_remount.cpp +++ b/fs_mgr/fs_mgr_remount.cpp @@ -340,6 +340,7 @@ int main(int argc, char* argv[]) { blk_device = rentry.blk_device; break; } + // Find overlayfs mount point? if ((mount_point == "/") && (rentry.mount_point == "/system")) { blk_device = rentry.blk_device; mount_point = "/system"; @@ -352,6 +353,12 @@ int main(int argc, char* argv[]) { } fs_mgr_set_blk_ro(blk_device, false); + // Find system-as-root mount point? + if ((mount_point == "/system") && !GetEntryForMountPoint(&mounts, mount_point) && + GetEntryForMountPoint(&mounts, "/")) { + mount_point = "/"; + } + // Now remount! if (::mount(blk_device.c_str(), mount_point.c_str(), entry.fs_type.c_str(), MS_REMOUNT, nullptr) == 0) {