Re: [RFC] exit: do exit_task_work() before shooting off mm

From: Al Viro
Date: Mon Dec 07 2020 - 20:38:12 EST


On Thu, Dec 03, 2020 at 02:30:46AM +0000, Pavel Begunkov wrote:
> Handle task works and lock it earlier before it starts killing off
> task's resources like mm. io_uring makes use of it a lot and it'd
> nicer to have all added task_work finding tasks in a consistent state.
>
> Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
> ---
>
> Would it be correct? I clearly don't know all the exit invariants, but
> can't find any users relying on task_works in-between.

You've just gotten rid of exit_task_work() anywhere after exit_files().
And exit_mm() can trigger the final fput() just as easily as exit_files().

IOW, you have just made the effect of final close on exit() completely
asynchronous.

NAK.