Handle failures after partial mounts
When we try mounting an EmulatedVolume, we may mount sdcardfs but fail in any of the FUSE mounts, in this case we should unmount whatever mounts we made during the mount. Test: Intentionally causing a partial failure, verified that sdcardfs gets unmounted Bug: 147610762 Change-Id: I29ed044ed8ab8aa3dd83bc97a49eb3140ce4fe27
This commit is contained in:
parent
636123c523
commit
df073f50d2
1 changed files with 8 additions and 1 deletions
|
@ -245,12 +245,19 @@ status_t EmulatedVolume::doMount() {
|
|||
bool is_ready = false;
|
||||
callback->onVolumeChecking(std::move(fd), getPath(), getInternalPath(), &is_ready);
|
||||
if (!is_ready) {
|
||||
fd.reset();
|
||||
doUnmount();
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
// Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path.
|
||||
return mountFuseBindMounts();
|
||||
status_t res = mountFuseBindMounts();
|
||||
if (res != OK) {
|
||||
fd.reset();
|
||||
doUnmount();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
Loading…
Reference in a new issue