init/reboot: call MNT_FORCE at the last umount(2)

The last one will avoid errors=panic in ext4.

Bug: 63981945
Bug: 65481582
Change-Id: I9c86afcce441767e24fc43668ab1ff6230155a9f
Merged-In: I9c86afcce441767e24fc43668ab1ff6230155a9f
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
(cherry picked from commit 0f04f72c2d)
This commit is contained in:
Jaegeuk Kim 2017-09-25 10:55:39 -07:00
parent 924045b63a
commit bf141af6be
1 changed files with 4 additions and 4 deletions

View File

@ -84,8 +84,8 @@ class MountEntry {
mnt_type_(entry.mnt_type),
mnt_opts_(entry.mnt_opts) {}
bool Umount() {
int r = umount2(mnt_dir_.c_str(), 0);
bool Umount(bool force) {
int r = umount2(mnt_dir_.c_str(), force ? MNT_FORCE : 0);
if (r == 0) {
LOG(INFO) << "umounted " << mnt_fsname_ << ":" << mnt_dir_ << " opts " << mnt_opts_;
return true;
@ -287,11 +287,11 @@ static UmountStat UmountPartitions(std::chrono::milliseconds timeout) {
}
if (emulated_devices.size() > 0 &&
std::all_of(emulated_devices.begin(), emulated_devices.end(),
[](auto& entry) { return entry.Umount(); })) {
[](auto& entry) { return entry.Umount(false); })) {
sync();
}
for (auto& entry : block_devices) {
entry.Umount();
entry.Umount(timeout == 0ms);
}
retry++;
std::this_thread::sleep_for(100ms);