Loading init/mount_namespace.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -323,10 +323,20 @@ bool SwitchToBootstrapMountNamespaceIfNeeded() { } if (bootstrap_ns_id != GetMountNamespaceId() && bootstrap_ns_fd.get() != -1 && IsApexUpdatable()) { // The property service thread and its descendent threads must be in the correct mount // namespace to call Service::Start(), however setns() only operates on a single thread and // fails when secondary threads attempt to join the same mount namespace. Therefore, we // must join the property service thread and its descendents before the setns() call. Those // threads are then started again after the setns() call, and they'll be in the proper // namespace. PausePropertyService(); if (setns(bootstrap_ns_fd.get(), CLONE_NEWNS) == -1) { PLOG(ERROR) << "Failed to switch to bootstrap mount namespace."; return false; } ResumePropertyService(); } return true; } Loading init/reboot.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -820,6 +820,7 @@ static Result<void> DoUserspaceReboot() { LOG(INFO) << "Re-enabling service '" << s->name() << "'"; s->Enable(); } ServiceList::GetInstance().ResetState(); LeaveShutdown(); ActionManager::GetInstance().QueueEventTrigger("userspace-reboot-resume"); guard.Disable(); // Go on with userspace reboot. Loading init/service_list.h +5 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,11 @@ class ServiceList { bool IsServicesUpdated() const { return services_update_finished_; } void DelayService(const Service& service) REQUIRES(service_lock); void ResetState() { post_data_ = false; services_update_finished_ = false; } private: std::vector<std::unique_ptr<Service>> services_; Loading Loading
init/mount_namespace.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -323,10 +323,20 @@ bool SwitchToBootstrapMountNamespaceIfNeeded() { } if (bootstrap_ns_id != GetMountNamespaceId() && bootstrap_ns_fd.get() != -1 && IsApexUpdatable()) { // The property service thread and its descendent threads must be in the correct mount // namespace to call Service::Start(), however setns() only operates on a single thread and // fails when secondary threads attempt to join the same mount namespace. Therefore, we // must join the property service thread and its descendents before the setns() call. Those // threads are then started again after the setns() call, and they'll be in the proper // namespace. PausePropertyService(); if (setns(bootstrap_ns_fd.get(), CLONE_NEWNS) == -1) { PLOG(ERROR) << "Failed to switch to bootstrap mount namespace."; return false; } ResumePropertyService(); } return true; } Loading
init/reboot.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -820,6 +820,7 @@ static Result<void> DoUserspaceReboot() { LOG(INFO) << "Re-enabling service '" << s->name() << "'"; s->Enable(); } ServiceList::GetInstance().ResetState(); LeaveShutdown(); ActionManager::GetInstance().QueueEventTrigger("userspace-reboot-resume"); guard.Disable(); // Go on with userspace reboot. Loading
init/service_list.h +5 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,11 @@ class ServiceList { bool IsServicesUpdated() const { return services_update_finished_; } void DelayService(const Service& service) REQUIRES(service_lock); void ResetState() { post_data_ = false; services_update_finished_ = false; } private: std::vector<std::unique_ptr<Service>> services_; Loading