diff mbox series

io_uring: drop mm/files between task_work_submit

Message ID 741fe19ee895393f54d01b8f7d25242e7fa27120.1612466514.git.asml.silence@gmail.com
State Accepted
Commit aec18a57edad562d620f7d19016de1fc0cc2208c
Headers show
Series io_uring: drop mm/files between task_work_submit | expand

Commit Message

Pavel Begunkov Feb. 4, 2021, 7:22 p.m. UTC
Since SQPOLL task can be shared and so task_work entries can be a mix of
them, we need to drop mm and files before trying to issue next request.

Cc: stable@vger.kernel.org # 5.10+
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jens Axboe Feb. 4, 2021, 7:43 p.m. UTC | #1
On 2/4/21 12:22 PM, Pavel Begunkov wrote:
> Since SQPOLL task can be shared and so task_work entries can be a mix of
> them, we need to drop mm and files before trying to issue next request.

Thanks, applied.
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5d3348d66f06..1f68105a41ed 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2205,6 +2205,9 @@  static void __io_req_task_submit(struct io_kiocb *req)
 	else
 		__io_req_task_cancel(req, -EFAULT);
 	mutex_unlock(&ctx->uring_lock);
+
+	if (ctx->flags & IORING_SETUP_SQPOLL)
+		io_sq_thread_drop_mm_files();
 }
 
 static void io_req_task_submit(struct callback_head *cb)