Skip to content

Commit b81762c

Browse files
Merge "Use lower filesystem path when destroying user data with FUSE" am: 5d4883d am: d8dd9ff am: 94e1110
Change-Id: Ic48c8832e77ad548457ae82b14fc7148baccfc73
2 parents e186b00 + 94e1110 commit b81762c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cmds/installd/InstalldNativeService.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,6 +2595,8 @@ binder::Status InstalldNativeService::invalidateMounts() {
25952595
std::getline(in, ignored);
25962596

25972597
if (android::base::GetBoolProperty(kFuseProp, false)) {
2598+
// TODO(b/146139106): Use sdcardfs mounts on devices running sdcardfs so we don't bypass
2599+
// it's VFS cache
25982600
if (target.compare(0, 17, "/mnt/pass_through") == 0) {
25992601
LOG(DEBUG) << "Found storage mount " << source << " at " << target;
26002602
mStorageMounts[source] = target;
@@ -2616,6 +2618,17 @@ std::string InstalldNativeService::findDataMediaPath(
26162618
std::lock_guard<std::recursive_mutex> lock(mMountsLock);
26172619
const char* uuid_ = uuid ? uuid->c_str() : nullptr;
26182620
auto path = StringPrintf("%s/media", create_data_path(uuid_).c_str());
2621+
if (android::base::GetBoolProperty(kFuseProp, false)) {
2622+
// TODO(b/146139106): This is only safe on devices not running sdcardfs where there is no
2623+
// risk of bypassing the sdcardfs VFS cache
2624+
2625+
// Always use the lower filesystem path on FUSE enabled devices not running sdcardfs
2626+
// The upper filesystem path, /mnt/pass_through/<userid>/<vol>/ which was a bind mount
2627+
// to the lower filesytem may have been unmounted already when a user is
2628+
// removed and the path will now be pointing to a tmpfs without content
2629+
return StringPrintf("%s/%u", path.c_str(), userid);
2630+
}
2631+
26192632
auto resolved = mStorageMounts[path];
26202633
if (resolved.empty()) {
26212634
LOG(WARNING) << "Failed to find storage mount for " << path;

0 commit comments

Comments
 (0)