Always unmount data and obb directory that mounted

Otherwise, when system removes user's volume, it will hang
as there are mounts (obb and data mounts) still remain mounted in system.

Bug: 187122943
Test: atest UserLifecycleTests#managedProfileUnlock_stopped, it's not blocked anymore

Change-Id: Ic37985f98e6cbfe4fa38b981d3332c4dfc40c5b8
This commit is contained in:
Ricky Wai 2021-05-05 14:43:45 +00:00
parent b2678b6654
commit 5f2a9fee66

View file

@ -194,7 +194,9 @@ status_t EmulatedVolume::unmountFuseBindMounts() {
// Here we assume obb/data dirs is mounted as tmpfs, then it must be caused by // Here we assume obb/data dirs is mounted as tmpfs, then it must be caused by
// app data isolation. // app data isolation.
KillProcessesWithTmpfsMountPrefix(appObbDir); KillProcessesWithTmpfsMountPrefix(appObbDir);
} else { }
// Always unmount data and obb dirs as they are mounted to lowerfs for speeding up access.
std::string androidDataTarget( std::string androidDataTarget(
StringPrintf("/mnt/user/%d/%s/%d/Android/data", userId, label.c_str(), userId)); StringPrintf("/mnt/user/%d/%s/%d/Android/data", userId, label.c_str(), userId));
@ -214,7 +216,6 @@ status_t EmulatedVolume::unmountFuseBindMounts() {
return status; return status;
} }
LOG(INFO) << "Unmounted " << androidObbTarget; LOG(INFO) << "Unmounted " << androidObbTarget;
}
return OK; return OK;
} }