Commit a7607b50 authored by Nicholas Verne's avatar Nicholas Verne Committed by Commit Bot

Unmount old Crostini ssh volumes on startup.

If Chrome crashes while crostini is running, old mount points for the
sshfs file system are still polluting mtab, and if we don't remove
them here, then on restarting the VM we still won't be able to use
Linux files in the files app. Hence we remove the old mounts at session
startup if it's an unclean startup.

Bug: 1057899
Change-Id: Ib5082c973e245800ac976efcecfd0aad96fe998d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089538
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Auto-Submit: Nicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarDavid Munro <davidmunro@google.com>
Cr-Commit-Position: refs/heads/master@{#748081}
parent 78ab5064
......@@ -932,6 +932,9 @@ void CrostiniManager::MaybeUpdateCrostini() {
VLOG(1) << "Exit type: " << static_cast<int>(Profile::EXIT_CRASHED);
VLOG(1) << "ListVmDisks result: " << static_cast<int>(result);
weak_this->is_unclean_startup_ = result == CrostiniResult::SUCCESS;
if (weak_this->is_unclean_startup_) {
weak_this->RemoveUncleanSshfsMounts();
}
}
},
weak_ptr_factory_.GetWeakPtr()));
......@@ -3424,4 +3427,10 @@ void CrostiniManager::OnRemoveSshfsCrostiniVolume(
power_manager_suspend_token);
}
void CrostiniManager::RemoveUncleanSshfsMounts() {
file_manager::VolumeManager::Get(profile_)->RemoveSshfsCrostiniVolume(
file_manager::util::GetCrostiniMountDirectory(profile_),
base::DoNothing());
}
} // namespace crostini
......@@ -607,6 +607,7 @@ class CrostiniManager : public KeyedService,
void EnsureVmRunning(const ContainerId& key, CrostiniResultCallback callback);
bool IsUncleanStartup() const;
void SetUncleanStartupForTesting(bool is_unclean_startup);
void RemoveUncleanSshfsMounts();
private:
class CrostiniRestarter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment