summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@google.com>2017-10-05 20:43:55 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-05 20:43:55 +0000
commitfd1852728b82091b450853881c62224025c5d74e (patch)
tree1ae19fc32de1d351e47bbf3f60096da98deb5e38 /init
parentdf0df2455f44d14e6adc81aa7b9da505391a06bc (diff)
parent647a720ee199dd8c15c01bc047766086bedf170e (diff)
downloadcore-fd1852728b82091b450853881c62224025c5d74e.tar.gz
core-fd1852728b82091b450853881c62224025c5d74e.tar.bz2
core-fd1852728b82091b450853881c62224025c5d74e.zip
Merge "init/reboot: call MNT_FORCE at the last umount(2)" am: 4e008547be am: eacc9cd637
am: 647a720ee1 Change-Id: Idd01e0c5ff4ee5c6f0b18525c7f140b4e0d2c086
Diffstat (limited to 'init')
-rw-r--r--init/reboot.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/init/reboot.cpp b/init/reboot.cpp
index d06dcc559..a4a20f343 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -86,8 +86,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;
@@ -280,14 +280,15 @@ static UmountStat UmountPartitions(std::chrono::milliseconds timeout) {
bool unmount_done = true;
if (emulated_devices.size() > 0) {
unmount_done = std::all_of(emulated_devices.begin(), emulated_devices.end(),
- [](auto& entry) { return entry.Umount(); });
+ [](auto& entry) { return entry.Umount(false); });
if (unmount_done) {
sync();
}
}
- unmount_done = std::all_of(block_devices.begin(), block_devices.end(),
- [](auto& entry) { return entry.Umount(); }) &&
- unmount_done;
+ unmount_done =
+ std::all_of(block_devices.begin(), block_devices.end(),
+ [&timeout](auto& entry) { return entry.Umount(timeout == 0ms); }) &&
+ unmount_done;
if (unmount_done) {
return UMOUNT_STAT_SUCCESS;
}