From: Pavel Begunkov Date: Mon, 18 Apr 2022 19:51:12 +0000 (+0100) Subject: io_uring: refactor io_assign_file error path X-Git-Tag: for-5.19/io_uring-2022-05-22~67 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=772f5e002b9ef65c22956990be9ecb2df58cd9c9;p=linux-2.6-block.git io_uring: refactor io_assign_file error path All io_assign_file() callers do error handling themselves, req_set_fail() in the io_assign_file()'s fail path needlessly bloats the kernel and is not the best abstraction to have. Simplify the error path. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/eff77fb1eac2b6a90cca5223813e6a396ffedec0.1650311386.git.asml.silence@gmail.com Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 1b8597b82f6a..75be769ce652 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7134,12 +7134,8 @@ static bool io_assign_file(struct io_kiocb *req, unsigned int issue_flags) req->file = io_file_get_fixed(req, req->cqe.fd, issue_flags); else req->file = io_file_get_normal(req, req->cqe.fd); - if (req->file) - return true; - req_set_fail(req); - req->cqe.res = -EBADF; - return false; + return !!req->file; } static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)