From ab9ea463b8899bb0b75c9dc7436a7741d9a92fa9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 26 May 2022 00:28:09 +0000 Subject: Fix directory comparison in tryMountDataMirror Inode numbers are only distinct within a single filesystem. To determine whether two paths name the same file, both the inode number and device number need to be compared. Also downgrade the log message to INFO since this case is expected. Test: On Cuttlefish: sm partition disk:253,32 private logcat | grep 'is mounted already' # message still appears Change-Id: Ic1db53d4c3842b3ecc57a498b8c1300377b27e8a --- cmds/installd/InstalldNativeService.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index 3335dc7b72..ee3a67e5fd 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -3505,10 +3505,10 @@ binder::Status InstalldNativeService::tryMountDataMirror( return error("Failed to stat " + mirrorVolCePath); } - if (mirrorCeStat.st_ino == ceStat.st_ino) { + if (mirrorCeStat.st_ino == ceStat.st_ino && mirrorCeStat.st_dev == ceStat.st_dev) { // As it's being called by prepareUserStorage, it can be called multiple times. // Hence, we if we mount it already, we should skip it. - LOG(WARNING) << "CE dir is mounted already: " + cePath; + LOG(INFO) << "CE dir is mounted already: " + cePath; return ok(); } -- cgit v1.2.3-59-g8ed1b