mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
task_work: task_work_add() should not succeed after exit_task_work()
ed3e694d
"move exit_task_work() past exit_files() et.al" destroyed
the add/exit synchronization we had, the caller itself should ensure
task_work_add() can't race with the exiting task.
However, this is not convenient/simple, and the only user which tries
to do this is buggy (see the next patch). Unless the task is current,
there is simply no way to do this in general.
Change exit_task_work()->task_work_run() to use the dummy "work_exited"
entry to let task_work_add() know it should fail.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120826191211.GA4228@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
ac3d0da8f3
commit
9da33de624
2 changed files with 17 additions and 8 deletions
|
@ -18,8 +18,7 @@ void task_work_run(void);
|
|||
|
||||
static inline void exit_task_work(struct task_struct *task)
|
||||
{
|
||||
if (unlikely(task->task_works))
|
||||
task_work_run();
|
||||
task_work_run();
|
||||
}
|
||||
|
||||
#endif /* _LINUX_TASK_WORK_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue