From 5ad7b3cbc5c1e1c92455a29403f465fb8d501c27 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Wed, 17 Feb 2021 12:48:53 -0800 Subject: [PATCH] Try to remount mounted points only If we don't mount a certain partition intentionally, should be okay to bypass remounting the partition. Bug: 180435772 Signed-off-by: Jaegeuk Kim Change-Id: I7e4d420693f8ba35ec7881d39d0ca682688743c5 --- 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 745dab24c..e685070a8 100644 --- a/fs_mgr/fs_mgr_remount.cpp +++ b/fs_mgr/fs_mgr_remount.cpp @@ -411,19 +411,26 @@ static int do_remount(int argc, char* argv[]) { auto blk_device = entry.blk_device; auto mount_point = entry.mount_point; + auto found = false; for (auto it = mounts.rbegin(); it != mounts.rend(); ++it) { auto& rentry = *it; if (mount_point == rentry.mount_point) { blk_device = rentry.blk_device; + found = true; break; } // Find overlayfs mount point? if ((mount_point == "/") && (rentry.mount_point == "/system")) { blk_device = rentry.blk_device; mount_point = "/system"; + found = true; break; } } + if (!found) { + PLOG(INFO) << "skip unmounted partition dev:" << blk_device << " mnt:" << mount_point; + continue; + } if (blk_device == "/dev/root") { auto from_fstab = GetEntryForMountPoint(&fstab, mount_point); if (from_fstab) blk_device = from_fstab->blk_device;