Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 106d7168 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge changes from topic "libinit_test_utils-build-error" into rvc-dev am:...

Merge changes from topic "libinit_test_utils-build-error" into rvc-dev am: 2c005614 am: 092d9598

Change-Id: I71d15ac522bb6177bff44be0926f1b3485a2497a
parents 82915b6f 092d9598
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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;
}