diff options
author | Nikita Ioffe <ioffe@google.com> | 2020-09-07 10:27:25 +0100 |
---|---|---|
committer | Nikita Ioffe <ioffe@google.com> | 2020-09-08 21:58:43 +0100 |
commit | 9ede7ec273539d7ad6820bdf3f1f2f28433a9fb3 (patch) | |
tree | 626a5210f77f3ea0f87439294a4cafa0d24db49e /init/builtins.cpp | |
parent | 01a30c0d2bb3bd024d83e0ae09c3552c9cc0d5c9 (diff) |
Only store result of mount_all that mounted userdata
During boot sequence there can be multiple calls to mount_all. For the
userspace reboot to correctly remount userdata, we need to store the
return code of the one that was responsible in mounting userdata.
Test: adb root
Test: adb shell setprop init.userspace_reboot.is_supported 1
Test: adb reboot userspace
Test: checked dmsg
Bug: 166353152
Change-Id: Id0ae15f3bcf65fa54e4e72b76f64716c053af7fb
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 597c32d05..d00d1b121 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -662,18 +662,26 @@ static Result<void> do_mount_all(const BuiltinArguments& args) { } } - auto mount_fstab_return_code = fs_mgr_mount_all(&fstab, mount_all->mode); + auto mount_fstab_result = fs_mgr_mount_all(&fstab, mount_all->mode); SetProperty(prop_name, std::to_string(t.duration().count())); if (mount_all->import_rc) { import_late(mount_all->rc_paths); } + if (mount_fstab_result.userdata_mounted) { + // This call to fs_mgr_mount_all mounted userdata. Keep the result in + // order for userspace reboot to correctly remount userdata. + LOG(INFO) << "Userdata mounted using " + << (mount_all->fstab_path.empty() ? "(default fstab)" : mount_all->fstab_path) + << " result : " << mount_fstab_result.code; + initial_mount_fstab_return_code = mount_fstab_result.code; + } + if (queue_event) { /* queue_fs_event will queue event based on mount_fstab return code * and return processed return code*/ - initial_mount_fstab_return_code = mount_fstab_return_code; - auto queue_fs_result = queue_fs_event(mount_fstab_return_code, false); + auto queue_fs_result = queue_fs_event(mount_fstab_result.code, false); if (!queue_fs_result.ok()) { return Error() << "queue_fs_event() failed: " << queue_fs_result.error(); } |