Unmount public volume if FUSE mount fails

Sometimes, during early boot, a public volume may be created before
the user is unlocked and the mount may fail. This mount failure does
not revert the lower fs mounts (sdcardfs and vfat). Subsequent
mount attempts will then fail because we'd attempt to mount vfat on
already mounted /mnt/media_rw/<volname>

Bug: 158489548
Test: Resilient to an artificial sleep in
StorageManagerService#completeUnlockUser to
delay user unlock longer than public volume mount

Change-Id: I9a1574596434a2eb6b2553c0c9220c2118c7e4fd
gugelfrei
Zim 4 years ago
parent f87198e025
commit f71707916f

@ -238,6 +238,7 @@ status_t PublicVolume::doMount() {
if (result != 0) {
LOG(ERROR) << "Failed to mount public fuse volume";
doUnmount();
return -result;
}
@ -247,6 +248,8 @@ status_t PublicVolume::doMount() {
bool is_ready = false;
callback->onVolumeChecking(std::move(fd), getPath(), getInternalPath(), &is_ready);
if (!is_ready) {
LOG(ERROR) << "Failed to complete public volume mount";
doUnmount();
return -EIO;
}
}

Loading…
Cancel
Save