Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84665
b: refs/heads/master
c: 5dee170
h: refs/heads/master
i:
  84663: b16a391
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Feb 8, 2008
1 parent 5dea8d0 commit 338e29f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6806aac6d282d58b97763f5e17e2787e62c3b440
refs/heads/master: 5dee1707dfbfc55eb7569b9ae5abaf932bd4c377
18 changes: 0 additions & 18 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,24 +745,6 @@ static void exit_notify(struct task_struct *tsk)
struct task_struct *t;
struct pid *pgrp;

if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT)
&& !thread_group_empty(tsk)) {
/*
* This occurs when there was a race between our exit
* syscall and a group signal choosing us as the one to
* wake up. It could be that we are the only thread
* alerted to check for pending signals, but another thread
* should be woken now to take the signal since we will not.
* Now we'll wake all the threads in the group just to make
* sure someone gets all the pending signals.
*/
spin_lock_irq(&tsk->sighand->siglock);
for (t = next_thread(tsk); t != tsk; t = next_thread(t))
if (!signal_pending(t) && !(t->flags & PF_EXITING))
recalc_sigpending_and_wake(t);
spin_unlock_irq(&tsk->sighand->siglock);
}

/*
* This does two things:
*
Expand Down
27 changes: 22 additions & 5 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1903,19 +1903,36 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
void exit_signals(struct task_struct *tsk)
{
int group_stop = 0;
struct task_struct *t;

spin_lock_irq(&tsk->sighand->siglock);
if (unlikely(tsk->signal->group_stop_count) &&
!--tsk->signal->group_stop_count) {
tsk->signal->flags = SIGNAL_STOP_STOPPED;
group_stop = 1;
if (thread_group_empty(tsk) || signal_group_exit(tsk->signal)) {
tsk->flags |= PF_EXITING;
return;
}

spin_lock_irq(&tsk->sighand->siglock);
/*
* From now this task is not visible for group-wide signals,
* see wants_signal(), do_signal_stop().
*/
tsk->flags |= PF_EXITING;
if (!signal_pending(tsk))
goto out;

/* It could be that __group_complete_signal() choose us to
* notify about group-wide signal. Another thread should be
* woken now to take the signal since we will not.
*/
for (t = tsk; (t = next_thread(t)) != tsk; )
if (!signal_pending(t) && !(t->flags & PF_EXITING))
recalc_sigpending_and_wake(t);

if (unlikely(tsk->signal->group_stop_count) &&
!--tsk->signal->group_stop_count) {
tsk->signal->flags = SIGNAL_STOP_STOPPED;
group_stop = 1;
}
out:
spin_unlock_irq(&tsk->sighand->siglock);

if (unlikely(group_stop)) {
Expand Down

0 comments on commit 338e29f

Please sign in to comment.