From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org, Eric Paris <eparis@parisplace.org>
Subject: Re: I finally prepared a testcase for read(inotify_fd) getting EINTR on PTRACE_ATTACH
Date: Fri, 10 Feb 2012 16:09:23 +0100 [thread overview]
Message-ID: <20120210150923.GA12322@redhat.com> (raw)
In-Reply-To: <20120210144846.GA10798@redhat.com>
On 02/10, Oleg Nesterov wrote:
>
> Add CC's,
>
> On 02/10, Denys Vlasenko wrote:
> >
> > I recalled that I saw a spurious EINTR on strace attach.
> > I found time/inspiration to create an isolated testcase for it.
> > Already committed it to ptrace-tests.
> >
> > The code: skip all the cruft, read reproduce() function body.
> > It's quite straightforward.
> >
> > $ gcc -Wall -Os eintr-on-attach.c -oeintr-on-attach
> > $ ./eintr-on-attach 1;echo 1
> > bug: read was interrupted by attach, errno: Interrupted system call
>
> At first glance this looks obvious? I never used inotify and I never
> looked into fs/notify/inotify/, but it seems that inotify_read() simply
> returns -EINTR if signal_pending() and doesn't implement restarts.
>
> Probably this trivial change
>
>
> --- x/fs/notify/inotify/inotify_user.c
> +++ x/fs/notify/inotify/inotify_user.c
> @@ -264,7 +264,7 @@ static ssize_t inotify_read(struct file
> ret = -EAGAIN;
> if (file->f_flags & O_NONBLOCK)
> break;
> - ret = -EINTR;
> + ret = -ERESTARTSYS;
> if (signal_pending(current))
> break;
>
>
> makes sense.
except I meant -ERESTARTNOHAND to avoid the behavioural change.
Oleg.
next prev parent reply other threads:[~2012-02-10 15:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4F352565.6030402@redhat.com>
2012-02-10 14:48 ` I finally prepared a testcase for read(inotify_fd) getting EINTR on PTRACE_ATTACH Oleg Nesterov
2012-02-10 15:09 ` Oleg Nesterov [this message]
2012-02-10 16:19 ` Denys Vlasenko
2012-02-10 16:30 ` 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=20120210150923.GA12322@redhat.com \
--to=oleg@redhat.com \
--cc=dvlasenk@redhat.com \
--cc=eparis@parisplace.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).