aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-03-28 19:11:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 21:36:44 -0500
commit88531f725bd52e37a7be726860e4ff3f09031d89 (patch)
treee43f25881012112e29d3fc13e75ccc3ba3cd4dba /kernel
parentaacc90944d4b1f2fcec73a8127eb60a3a701ce1c (diff)
[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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/signal.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index e3bdec914626..2dfaa5076c31 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2301,8 +2301,7 @@ sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo)
2301 return kill_proc_info(sig, &info, pid); 2301 return kill_proc_info(sig, &info, pid);
2302} 2302}
2303 2303
2304int 2304int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2305do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2306{ 2305{
2307 struct k_sigaction *k; 2306 struct k_sigaction *k;
2308 sigset_t mask; 2307 sigset_t mask;
@@ -2328,6 +2327,7 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2328 if (act) { 2327 if (act) {
2329 sigdelsetmask(&act->sa.sa_mask, 2328 sigdelsetmask(&act->sa.sa_mask,
2330 sigmask(SIGKILL) | sigmask(SIGSTOP)); 2329 sigmask(SIGKILL) | sigmask(SIGSTOP));
2330 *k = *act;
2331 /* 2331 /*
2332 * POSIX 3.3.1.3: 2332 * POSIX 3.3.1.3:
2333 * "Setting a signal action to SIG_IGN for a signal that is 2333 * "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)
2340 * be discarded, whether or not it is blocked" 2340 * be discarded, whether or not it is blocked"
2341 */ 2341 */
2342 if (act->sa.sa_handler == SIG_IGN || 2342 if (act->sa.sa_handler == SIG_IGN ||
2343 (act->sa.sa_handler == SIG_DFL && 2343 (act->sa.sa_handler == SIG_DFL && sig_kernel_ignore(sig))) {
2344 sig_kernel_ignore(sig))) {
2345 /*
2346 * This is a fairly rare case, so we only take the
2347 * tasklist_lock once we're sure we'll need it.
2348 * Now we must do this little unlock and relock
2349 * dance to maintain the lock hierarchy.
2350 */
2351 struct task_struct *t = current; 2344 struct task_struct *t = current;
2352 spin_unlock_irq(&t->sighand->siglock);
2353 read_lock(&tasklist_lock);
2354 spin_lock_irq(&t->sighand->siglock);
2355 *k = *act;
2356 sigemptyset(&mask); 2345 sigemptyset(&mask);
2357 sigaddset(&mask, sig); 2346 sigaddset(&mask, sig);
2358 rm_from_queue_full(&mask, &t->signal->shared_pending); 2347 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)
2361 recalc_sigpending_tsk(t); 2350 recalc_sigpending_tsk(t);
2362 t = next_thread(t); 2351 t = next_thread(t);
2363 } while (t != current); 2352 } while (t != current);
2364 spin_unlock_irq(&current->sighand->siglock);
2365 read_unlock(&tasklist_lock);
2366 return 0;
2367 } 2353 }
2368
2369 *k = *act;
2370 } 2354 }
2371 2355
2372 spin_unlock_irq(&current->sighand->siglock); 2356 spin_unlock_irq(&current->sighand->siglock);