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
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 3335dc7..ee3a67e 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -3505,10 +3505,10 @@
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();
}