提交 492cf1ed 编写于 作者: P Pavel Begunkov 提交者: Xiaoguang Wang

io_uring: get rid of manual punting in io_close

to #28736503

commit 0bf0eefdab52d9f9f3a1eeda32a4fc7afe4e9219 upstream

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: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 7f7487a9
...@@ -3486,21 +3486,14 @@ static int io_close(struct io_kiocb *req, bool force_nonblock) ...@@ -3486,21 +3486,14 @@ static int io_close(struct io_kiocb *req, bool force_nonblock)
req->close.put_file = NULL; req->close.put_file = NULL;
ret = __close_fd_get_file(req->close.fd, &req->close.put_file); ret = __close_fd_get_file(req->close.fd, &req->close.put_file);
if (ret < 0) if (ret < 0)
return ret; return (ret == -ENOENT) ? -EBADF : ret;
/* if the file has a flush method, be safe and punt to async */ /* if the file has a flush method, be safe and punt to async */
if (req->close.put_file->f_op->flush && force_nonblock) { if (req->close.put_file->f_op->flush && force_nonblock) {
/* submission ref will be dropped, take it for async */ /* avoid grabbing files - we don't need the files */
refcount_inc(&req->refs); req->flags |= REQ_F_NO_FILE_TABLE | REQ_F_MUST_PUNT;
req->work.func = io_close_finish; req->work.func = io_close_finish;
/* return -EAGAIN;
* 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;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册