io_uring: acquire 'mm' for task_work for SQPOLL
authorJens Axboe <axboe@kernel.dk>
Wed, 17 Jun 2020 00:42:49 +0000 (18:42 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 17 Jun 2020 18:49:16 +0000 (12:49 -0600)
commit9d8426a09195e2dcf2aa249de2aaadd792d491c7
tree869fea84308ffa827fcd92a85d6fbe55686213a9
parentbbde017a32b32d2fa8d5fddca25fade20132abf8
io_uring: acquire 'mm' for task_work for SQPOLL

If we're unlucky with timing, we could be running task_work after
having dropped the memory context in the sq thread. Since dropping
the context requires a runnable task state, we cannot reliably drop
it as part of our check-for-work loop in io_sq_thread(). Instead,
abstract out the mm acquire for the sq thread into a helper, and call
it from the async task work handler.

Cc: stable@vger.kernel.org # v5.7
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c