[PATCH] do_sigaction: don't take tasklist_lock
do_sigaction() does not need tasklist_lock anymore, we can simplify the code. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
aacc90944d
commit
88531f725b
1 changed files with 3 additions and 19 deletions
|
@ -2301,8 +2301,7 @@ sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo)
|
||||||
return kill_proc_info(sig, &info, pid);
|
return kill_proc_info(sig, &info, pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
||||||
do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
|
||||||
{
|
{
|
||||||
struct k_sigaction *k;
|
struct k_sigaction *k;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
|
@ -2328,6 +2327,7 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
||||||
if (act) {
|
if (act) {
|
||||||
sigdelsetmask(&act->sa.sa_mask,
|
sigdelsetmask(&act->sa.sa_mask,
|
||||||
sigmask(SIGKILL) | sigmask(SIGSTOP));
|
sigmask(SIGKILL) | sigmask(SIGSTOP));
|
||||||
|
*k = *act;
|
||||||
/*
|
/*
|
||||||
* POSIX 3.3.1.3:
|
* POSIX 3.3.1.3:
|
||||||
* "Setting a signal action to SIG_IGN for a signal that is
|
* "Setting a signal action to SIG_IGN for a signal that is
|
||||||
|
@ -2340,19 +2340,8 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
||||||
* be discarded, whether or not it is blocked"
|
* be discarded, whether or not it is blocked"
|
||||||
*/
|
*/
|
||||||
if (act->sa.sa_handler == SIG_IGN ||
|
if (act->sa.sa_handler == SIG_IGN ||
|
||||||
(act->sa.sa_handler == SIG_DFL &&
|
(act->sa.sa_handler == SIG_DFL && sig_kernel_ignore(sig))) {
|
||||||
sig_kernel_ignore(sig))) {
|
|
||||||
/*
|
|
||||||
* This is a fairly rare case, so we only take the
|
|
||||||
* tasklist_lock once we're sure we'll need it.
|
|
||||||
* Now we must do this little unlock and relock
|
|
||||||
* dance to maintain the lock hierarchy.
|
|
||||||
*/
|
|
||||||
struct task_struct *t = current;
|
struct task_struct *t = current;
|
||||||
spin_unlock_irq(&t->sighand->siglock);
|
|
||||||
read_lock(&tasklist_lock);
|
|
||||||
spin_lock_irq(&t->sighand->siglock);
|
|
||||||
*k = *act;
|
|
||||||
sigemptyset(&mask);
|
sigemptyset(&mask);
|
||||||
sigaddset(&mask, sig);
|
sigaddset(&mask, sig);
|
||||||
rm_from_queue_full(&mask, &t->signal->shared_pending);
|
rm_from_queue_full(&mask, &t->signal->shared_pending);
|
||||||
|
@ -2361,12 +2350,7 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
||||||
recalc_sigpending_tsk(t);
|
recalc_sigpending_tsk(t);
|
||||||
t = next_thread(t);
|
t = next_thread(t);
|
||||||
} while (t != current);
|
} while (t != current);
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
|
||||||
read_unlock(&tasklist_lock);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*k = *act;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
|
|
Loading…
Reference in a new issue