diff options
author | Tejun Heo <tj@kernel.org> | 2011-05-12 04:47:23 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2011-05-13 12:56:02 -0400 |
commit | 19e274630c9e23a84d5940af83cf5db35103f968 (patch) | |
tree | 334344b87c92cf9d9ec6ea04151e1bf65742c58f /kernel/compat.c | |
parent | 40ae717d1e78d982bd469b2013a4cbf4ec1ca434 (diff) |
job control: reorganize wait_task_stopped()
wait_task_stopped() tested task_stopped_code() without acquiring
siglock and, if stop condition existed, called wait_task_stopped() and
directly returned the result. This patch moves the initial
task_stopped_code() testing into wait_task_stopped() and make
wait_consider_task() fall through to wait_task_continue() on 0 return.
This is for the following two reasons.
* Because the initial task_stopped_code() test is done without
acquiring siglock, it may race against SIGCONT generation. The
stopped condition might have been replaced by continued state by the
time wait_task_stopped() acquired siglock. This may lead to
unexpected failure of WNOHANG waits.
This reorganization addresses this single race case but there are
other cases - TASK_RUNNING -> TASK_STOPPED transition and EXIT_*
transitions.
* Scheduled ptrace updates require changes to the initial test which
would fit better inside wait_task_stopped().
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'kernel/compat.c')
0 files changed, 0 insertions, 0 deletions