Unmount pass_through path last.
There've been reports of issues where, when a volume is ejected, the MediaProvider process gets killed. This happens because the MediaProvider has a file open on the volume (eg, during a scan). We do abort the scan when the volume is ejected, however this could take some time. So, we give MediaProvider a bit more time before getting killed, by only looking for files open on the pass_through paths last. This order anyway seems to make more sense - ideally we kill apps using external storage before we unmount the pass_through path underlying it. Bug: 171367622 Test: atets AdoptableHostTest Change-Id: Ie8eacaa72a80ff8161ecf1e8c0243afcd890ee39
This commit is contained in:
parent
dfd36fe6b6
commit
64b3bba52e
1 changed files with 7 additions and 10 deletions
17
Utils.cpp
17
Utils.cpp
|
@ -1588,18 +1588,8 @@ status_t UnmountUserFuse(userid_t user_id, const std::string& absolute_lower_pat
|
||||||
std::string pass_through_path(
|
std::string pass_through_path(
|
||||||
StringPrintf("/mnt/pass_through/%d/%s", user_id, relative_upper_path.c_str()));
|
StringPrintf("/mnt/pass_through/%d/%s", user_id, relative_upper_path.c_str()));
|
||||||
|
|
||||||
// Best effort unmount pass_through path
|
|
||||||
sSleepOnUnmount = false;
|
|
||||||
LOG(INFO) << "Unmounting pass_through_path " << pass_through_path;
|
|
||||||
auto status = ForceUnmount(pass_through_path);
|
|
||||||
if (status != android::OK) {
|
|
||||||
LOG(ERROR) << "Failed to unmount " << pass_through_path;
|
|
||||||
}
|
|
||||||
rmdir(pass_through_path.c_str());
|
|
||||||
|
|
||||||
LOG(INFO) << "Unmounting fuse path " << fuse_path;
|
LOG(INFO) << "Unmounting fuse path " << fuse_path;
|
||||||
android::status_t result = ForceUnmount(fuse_path);
|
android::status_t result = ForceUnmount(fuse_path);
|
||||||
sSleepOnUnmount = true;
|
|
||||||
if (result != android::OK) {
|
if (result != android::OK) {
|
||||||
// TODO(b/135341433): MNT_DETACH is needed for fuse because umount2 can fail with EBUSY.
|
// TODO(b/135341433): MNT_DETACH is needed for fuse because umount2 can fail with EBUSY.
|
||||||
// Figure out why we get EBUSY and remove this special casing if possible.
|
// Figure out why we get EBUSY and remove this special casing if possible.
|
||||||
|
@ -1613,6 +1603,13 @@ status_t UnmountUserFuse(userid_t user_id, const std::string& absolute_lower_pat
|
||||||
}
|
}
|
||||||
rmdir(fuse_path.c_str());
|
rmdir(fuse_path.c_str());
|
||||||
|
|
||||||
|
LOG(INFO) << "Unmounting pass_through_path " << pass_through_path;
|
||||||
|
auto status = ForceUnmount(pass_through_path);
|
||||||
|
if (status != android::OK) {
|
||||||
|
LOG(ERROR) << "Failed to unmount " << pass_through_path;
|
||||||
|
}
|
||||||
|
rmdir(pass_through_path.c_str());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue