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 17:30:58 +0100 [thread overview]
Message-ID: <20120210163058.GA30072@redhat.com> (raw)
In-Reply-To: <4F3543AA.5040003@redhat.com>
On 02/10, Denys Vlasenko wrote:
>
> On 02/10/2012 04:09 PM, Oleg Nesterov wrote:
>> On 02/10, Oleg Nesterov wrote:
>>> 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.
>
> I run-tested the fix. It works: testcase no longer fails
> (modulo incorrect logic in the testcase which wase not working
> properly on "no bug detected" code path. Fixed one:
> http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/eintr-on-attach.c?cvsroot=systemtap
> )
Good, thanks.
> I'm not sure inotify really wants to deviate from other reads
> and return -EINTR even for SA_RESTARTing signals. IOW:
> I think -ERESTARTSYS here would be more correct than -ERESTARTNOHAND.
I am not sure either. ERESTARTNOHAND doesn't change the behaviour,
that was my point.
But I agree, ERESTARTSYS makes more sense to me.
Oleg.
prev parent reply other threads:[~2012-02-10 16:37 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
2012-02-10 16:19 ` Denys Vlasenko
2012-02-10 16:30 ` Oleg Nesterov [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=20120210163058.GA30072@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).