All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] epoll_wait: fix EINTR leak
Date: Mon, 24 Jun 2013 19:08:56 +0200	[thread overview]
Message-ID: <20130624170856.GA475@redhat.com> (raw)
In-Reply-To: <1372087913-7854-1-git-send-email-dvlasenk@redhat.com>

On 06/24, Denys Vlasenko wrote:
>
> Usage of EINTR is wrong.

I agree, this is not nice. However "fix EINTR leak" doesn't look
accurate, -EINTR is fine as an error code. Just the syscall should
restart if possible.

> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1598,7 +1598,7 @@ fetch_events:
>  			if (ep_events_available(ep) || timed_out)
>  				break;
>  			if (signal_pending(current)) {
> -				res = -EINTR;
> +				res = -ERESTARTNOHAND;

This and other similar changes do look right.

Say, sys_epoll_wait(). With this patch it can sleep, then return
ERESTARTNOHAND.

And we restart it with the same timeout again. If you want to
make it restartable, you need ERESTART_RESTARTBLOCK and
do_restart_epoll_wait() which we do not have.

See for example sys_poll() which implements this logic.

Oleg.


  reply	other threads:[~2013-06-24 17:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 15:31 [PATCH] epoll_wait: fix EINTR leak Denys Vlasenko
2013-06-24 17:08 ` Oleg Nesterov [this message]
2013-06-24 18:39   ` Oleg Nesterov

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=20130624170856.GA475@redhat.com \
    --to=oleg@redhat.com \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.