ptrace: simplify ptrace_exit()->ignoring_children() path
commit07325c8e8ed1eedb283941860cafb64fd60b46cd
authorOleg Nesterov <oleg@redhat.com>
Thu, 2 Apr 2009 23:58:12 +0000 (2 16:58 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 15 Jun 2009 16:40:19 +0000 (15 09:40 -0700)
treeb9f650698d2fc48824bf65f078310db5b4162570
parent887832b0dc724dec5d0fe7a0e58e035294ce1008
ptrace: simplify ptrace_exit()->ignoring_children() path

commit 6d69cb87f05eef3b02370b2f7bae608ad2301a00 upstream.

ignoring_children() takes parent->sighand->siglock and checks
k_sigaction[SIGCHLD] atomically.  But this buys nothing, we can't get the
"really" wrong result even if we race with sigaction(SIGCHLD).  If we read
the "stale" sa_handler/sa_flags we can pretend it was changed right after
the check.

Remove spin_lock(->siglock), and kill "int ign" which caches the result of
ignoring_children() which becomes rather trivial.

Perhaps it makes sense to export this helper, do_notify_parent() can use
it too.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/exit.c