diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-02-06 08:00:34 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-02-06 08:00:34 +0100 |
commit | e8a565cb660a7a11f76180fe441ba8e4f9383771 (patch) | |
tree | 05ca214885360c1c25787877b04e565cab785143 /src/core/socket.c | |
parent | Merge pull request #8101 from keszybz/two-gcc-workarounds (diff) | |
download | systemd-e8a565cb660a7a11f76180fe441ba8e4f9383771.tar.xz systemd-e8a565cb660a7a11f76180fe441ba8e4f9383771.zip |
core: make ExecRuntime be manager managed object
Before this, each ExecRuntime object is owned by a unit. However,
it may be shared with other units which enable JoinsNamespaceOf=.
Thus, by the serialization/deserialization process, its sharing
information, more specifically, reference counter is lost, and
causes issue #7790.
This makes ExecRuntime objects be managed by manager, and changes
the serialization/deserialization process.
Fixes #7790.
Diffstat (limited to 'src/core/socket.c')
-rw-r--r-- | src/core/socket.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 74cdebbe81..703f9f760f 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -164,7 +164,7 @@ static void socket_done(Unit *u) { s->peers_by_address = set_free(s->peers_by_address); - s->exec_runtime = exec_runtime_unref(s->exec_runtime); + s->exec_runtime = exec_runtime_unref(s->exec_runtime, false); exec_command_free_array(s->exec_command, _SOCKET_EXEC_COMMAND_MAX); s->control_command = NULL; @@ -1878,8 +1878,10 @@ static int socket_coldplug(Unit *u) { return r; } - if (!IN_SET(s->deserialized_state, SOCKET_DEAD, SOCKET_FAILED)) + if (!IN_SET(s->deserialized_state, SOCKET_DEAD, SOCKET_FAILED)) { (void) unit_setup_dynamic_creds(u); + (void) unit_setup_exec_runtime(u); + } socket_set_state(s, s->deserialized_state); return 0; @@ -2017,8 +2019,7 @@ static void socket_enter_dead(Socket *s, SocketResult f) { socket_set_state(s, s->result != SOCKET_SUCCESS ? SOCKET_FAILED : SOCKET_DEAD); - exec_runtime_destroy(s->exec_runtime); - s->exec_runtime = exec_runtime_unref(s->exec_runtime); + s->exec_runtime = exec_runtime_unref(s->exec_runtime, true); exec_context_destroy_runtime_directory(&s->exec_context, UNIT(s)->manager->prefix[EXEC_DIRECTORY_RUNTIME]); |