Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Olga Arkhangelskaia <krishtal.olja@gmail.com>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH v2] Fix O_NONBLOCK flag loss
Date: Mon, 13 Aug 2018 13:13:56 +0300	[thread overview]
Message-ID: <20180813101356.aroif4ogjigec24e@esperanza> (raw)
In-Reply-To: <20180813063758.40876-1-krishtal.olja@gmail.com>

Please prefix the subject line with a subsystem name ("say: " in your
case).

On Mon, Aug 13, 2018 at 09:37:58AM +0300, Olga Arkhangelskaia wrote:
> During syslog reconnect we lose nonblock flag. This leads to misbehavior
> while logging. Tarantool hangs forever.

> Test for this fix will be available in 1.10.

Please explain why (in the commit message).

> 
> Closes #3615
> ---
> https://github.com/tarantool/tarantool/issues/3615
> https://github.com/tarantool/tarantool/tree/OKriw/gh-3615-loss-nonblock-1.9
> 
> v1:
> https://www.freelists.org/post/tarantool-patches/PATCH-Fix-O-NONBLOCK-flag-loss
> 
> Changes in v2:
> -rebased on 1.9
> -changed set_nonblock arg
> -set flag in one more place
> 
>  src/say.c | 34 +++++++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/src/say.c b/src/say.c
> index 063e0295c..9c1066efc 100644
> --- a/src/say.c
> +++ b/src/say.c
> @@ -238,6 +238,23 @@ write_to_file(struct log *log, int total);
>  static void
>  write_to_syslog(struct log *log, int total);
>  
> +/**
> + * Sets O_NONBLOCK flag in case if lognonblock is set.
> + */
> +static void
> +set_nonblock(struct log *log)

Please prefix this function with 'log_' (log_set_nonblock), because this
function is a method of 'log' object.

> +{
> +	if (!log->nonblock)
> +		return;
> +	else {

'else' is pointless.

> +		int flags;
> +		if ((flags = fcntl(log->fd, F_GETFL, 0)) < 0 ||
> +				fcntl(log->fd, F_SETFL, flags | O_NONBLOCK) < 0) {

Malformed indentation. Please align the next line to 'if (', as we do
everywhere else.

> +			say_syserror("fcntl, fd=%i", log->fd);
> +		}
> +	}
> +}

      reply	other threads:[~2018-08-13 10:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13  6:37 Olga Arkhangelskaia
2018-08-13 10:13 ` Vladimir Davydov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180813101356.aroif4ogjigec24e@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=krishtal.olja@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v2] Fix O_NONBLOCK flag loss' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox