summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-02-12 18:41:15 +0000
committerJens Axboe <axboe@kernel.dk>2021-02-12 11:49:48 -0700
commitdc0eced5d92052a84d58df03a3bc6382f64fecfa (patch)
tree6b4b4b6bd6708452c5f1211810ed3c8e490d7b06
parent4fccfcbb733794634d4e873e7973c1847beca5bf (diff)
io_uring: don't check PF_EXITING from syscall
io_sq_thread_acquire_mm_files() can find a PF_EXITING task only when it's called from task_work context. Don't check it in all other cases, that are when we're in io_uring_enter(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 9c58be0579f3..66bbb0dc50af 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1213,8 +1213,6 @@ static int __io_sq_thread_acquire_mm_files(struct io_ring_ctx *ctx,
static inline int io_sq_thread_acquire_mm_files(struct io_ring_ctx *ctx,
struct io_kiocb *req)
{
- if (unlikely(current->flags & PF_EXITING))
- return -EFAULT;
if (!(ctx->flags & IORING_SETUP_SQPOLL))
return 0;
return __io_sq_thread_acquire_mm_files(ctx, req);
@@ -2338,7 +2336,8 @@ static void __io_req_task_submit(struct io_kiocb *req)
/* ctx stays valid until unlock, even if we drop all ours ctx->refs */
mutex_lock(&ctx->uring_lock);
- if (!ctx->sqo_dead && !io_sq_thread_acquire_mm_files(ctx, req))
+ if (!ctx->sqo_dead && !(current->flags & PF_EXITING) &&
+ !io_sq_thread_acquire_mm_files(ctx, req))
__io_queue_sqe(req);
else
__io_req_task_cancel(req, -EFAULT);