From: Pavel Begunkov Date: Sat, 27 Jun 2020 11:04:58 +0000 (+0300) Subject: io_uring: fix missing io_grab_files() X-Git-Tag: v5.10.7~2022^2~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=710c2bfb66474a186b0196e3342d43db0e6c04e1;p=platform%2Fkernel%2Flinux-rpi.git io_uring: fix missing io_grab_files() We won't have valid ring_fd, ring_file in task work. Grab files early. Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 545b137..4a9929c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5270,15 +5270,15 @@ static int io_req_defer_prep(struct io_kiocb *req, if (!sqe) return 0; - if (for_async || (req->flags & REQ_F_WORK_INITIALIZED)) { + if (io_op_defs[req->opcode].file_table) { io_req_init_async(req); + ret = io_grab_files(req); + if (unlikely(ret)) + return ret; + } - if (io_op_defs[req->opcode].file_table) { - ret = io_grab_files(req); - if (unlikely(ret)) - return ret; - } - + if (for_async || (req->flags & REQ_F_WORK_INITIALIZED)) { + io_req_init_async(req); io_req_work_grab_env(req, &io_op_defs[req->opcode]); }