summaryrefslogtreecommitdiff
path: root/cmds/installd/InstalldNativeService.cpp
diff options
context:
space:
mode:
author Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2019-12-12 20:47:18 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2019-12-12 20:47:18 +0000
commit94e1110fd2f8c2e7461945d76e3fd031e402e7c4 (patch)
tree87b6908211abeb4a8f3f66dda1065874748cb21d /cmds/installd/InstalldNativeService.cpp
parent5b65df5d49f2461390dcdab5eda21a756b4b336e (diff)
parentd8dd9ff6091eaedeadfd3efda6644b0280e0b208 (diff)
Merge "Use lower filesystem path when destroying user data with FUSE" am: 5d4883d82c am: d8dd9ff609
Change-Id: I4078d3a0570c6334e712022fcac38ca05373480c
Diffstat (limited to 'cmds/installd/InstalldNativeService.cpp')
-rw-r--r--cmds/installd/InstalldNativeService.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index b23d69c52f..a6e4e4efb6 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2799,6 +2799,8 @@ binder::Status InstalldNativeService::invalidateMounts() {
std::getline(in, ignored);
if (android::base::GetBoolProperty(kFuseProp, false)) {
+ // TODO(b/146139106): Use sdcardfs mounts on devices running sdcardfs so we don't bypass
+ // it's VFS cache
if (target.compare(0, 17, "/mnt/pass_through") == 0) {
LOG(DEBUG) << "Found storage mount " << source << " at " << target;
mStorageMounts[source] = target;
@@ -2820,6 +2822,17 @@ std::string InstalldNativeService::findDataMediaPath(
std::lock_guard<std::recursive_mutex> lock(mMountsLock);
const char* uuid_ = uuid ? uuid->c_str() : nullptr;
auto path = StringPrintf("%s/media", create_data_path(uuid_).c_str());
+ if (android::base::GetBoolProperty(kFuseProp, false)) {
+ // TODO(b/146139106): This is only safe on devices not running sdcardfs where there is no
+ // risk of bypassing the sdcardfs VFS cache
+
+ // Always use the lower filesystem path on FUSE enabled devices not running sdcardfs
+ // The upper filesystem path, /mnt/pass_through/<userid>/<vol>/ which was a bind mount
+ // to the lower filesytem may have been unmounted already when a user is
+ // removed and the path will now be pointing to a tmpfs without content
+ return StringPrintf("%s/%u", path.c_str(), userid);
+ }
+
auto resolved = mStorageMounts[path];
if (resolved.empty()) {
LOG(WARNING) << "Failed to find storage mount for " << path;