diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2020-05-26 20:34:06 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-05-26 13:31:09 -0600 |
commit | 0bf0eefdab52d9f9f3a1eeda32a4fc7afe4e9219 (patch) | |
tree | 04f53752230c0aa187f04140ee1b1367e85b4da4 /fs/io_uring.c | |
parent | 0451894522108d6c72934aff6ef89023743a9ed4 (diff) | |
download | lwn-0bf0eefdab52d9f9f3a1eeda32a4fc7afe4e9219.tar.gz lwn-0bf0eefdab52d9f9f3a1eeda32a4fc7afe4e9219.zip |
io_uring: get rid of manual punting in io_close
io_close() was punting async manually to skip grabbing files. Use
REQ_F_NO_FILE_TABLE instead, and pass it through the generic path
with -EAGAIN.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 0d98a529a93e..8c7a6e3e7669 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3492,25 +3492,15 @@ static int io_close(struct io_kiocb *req, bool force_nonblock) req->close.put_file = NULL; ret = __close_fd_get_file(req->close.fd, &req->close.put_file); - if (ret < 0) { - if (ret == -ENOENT) - ret = -EBADF; - return ret; - } + if (ret < 0) + return (ret == -ENOENT) ? -EBADF : ret; /* if the file has a flush method, be safe and punt to async */ if (req->close.put_file->f_op->flush && force_nonblock) { - /* submission ref will be dropped, take it for async */ - refcount_inc(&req->refs); - + /* avoid grabbing files - we don't need the files */ + req->flags |= REQ_F_NO_FILE_TABLE | REQ_F_MUST_PUNT; req->work.func = io_close_finish; - /* - * Do manual async queue here to avoid grabbing files - we don't - * need the files, and it'll cause io_close_finish() to close - * the file again and cause a double CQE entry for this request - */ - io_queue_async_work(req); - return 0; + return -EAGAIN; } /* |