From 15fe3b48a5271afa84fdf3f5f724e64161fdafe6 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Fri, 10 May 2019 15:06:56 -0700 Subject: [PATCH] fs_mgr: Fix EnsurePathMounted with a given mount_point. The expected behavior is to ensure the path mounted at the given mount point, instead of the one in fstab. Test: Boot into taimen recovery. Choose "Mount /system" from menu. Check that system image is mounted at /mnt/system. Change-Id: I07128e34bc47561afee8164611709a2b5393f9b7 --- fs_mgr/fs_mgr_roots.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs_mgr/fs_mgr_roots.cpp b/fs_mgr/fs_mgr_roots.cpp index 58ef9b6cd..1e655877f 100644 --- a/fs_mgr/fs_mgr_roots.cpp +++ b/fs_mgr/fs_mgr_roots.cpp @@ -101,7 +101,9 @@ bool EnsurePathMounted(Fstab* fstab, const std::string& path, const std::string& } } - auto mounted = GetMountState(rec->mount_point); + const std::string mount_point = mount_pt.empty() ? rec->mount_point : mount_pt; + + auto mounted = GetMountState(mount_point); if (mounted == MountState::ERROR) { return false; } @@ -109,8 +111,6 @@ bool EnsurePathMounted(Fstab* fstab, const std::string& path, const std::string& return true; } - const std::string mount_point = mount_pt.empty() ? rec->mount_point : mount_pt; - static const std::vector supported_fs{"ext4", "squashfs", "vfat", "f2fs", "none"}; if (std::find(supported_fs.begin(), supported_fs.end(), rec->fs_type) == supported_fs.end()) { LERROR << "unknown fs_type \"" << rec->fs_type << "\" for " << mount_point;