[systemd-devel] [PATCH] core: switch to journal when socket is listening

Lennart Poettering lennart at poettering.net
Mon Jun 17 11:54:22 PDT 2013


On Thu, 13.06.13 21:26, Umut Tezduyar (umut at tezduyar.com) wrote:

> systemd starts using journal as soon as the journal
> socket is in listening state instead of waiting for
> journal's socket to switch to 'running' state.
> ---
>  src/core/manager.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/core/manager.c b/src/core/manager.c
> index f16621a..cebc43e 100644
> --- a/src/core/manager.c
> +++ b/src/core/manager.c
> @@ -2613,7 +2613,8 @@ void manager_recheck_journal(Manager *m) {
>                  return;
>  
>          u = manager_get_unit(m, SPECIAL_JOURNALD_SOCKET);
> -        if (u && SOCKET(u)->state != SOCKET_RUNNING) {
> +        if (u && SOCKET(u)->state != SOCKET_RUNNING &&
> +                 SOCKET(u)->state != SOCKET_LISTENING) {
>                  log_close_journal();
>                  return;
>          }

This might result in a deadlock. If we start writing to the log socket
we might trigger starting of the journal daemon, which we ourselves have
to do, but if we block on the log socket then this might possible
deadlock.

We should probably instead try making SOCKET_RUNNING more reliable.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list