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

io_uring: clean up io_close

to #28170604

commit a2100672f3b2afdd55ccc2e640d1a8bd99ff6338 upstream

Don't abuse labels for plain and straightworward code.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 eee01f35
...@@ -3037,16 +3037,7 @@ static int io_close(struct io_kiocb *req, struct io_kiocb **nxt, ...@@ -3037,16 +3037,7 @@ static int io_close(struct io_kiocb *req, struct io_kiocb **nxt,
return ret; return 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 && !io_wq_current_is_worker()) if (req->close.put_file->f_op->flush && force_nonblock) {
goto eagain;
/*
* No ->flush(), safely close from here and just punt the
* fput() to async context.
*/
__io_close_finish(req, nxt);
return 0;
eagain:
req->work.func = io_close_finish; req->work.func = io_close_finish;
/* /*
* Do manual async queue here to avoid grabbing files - we don't * Do manual async queue here to avoid grabbing files - we don't
...@@ -3055,6 +3046,14 @@ static int io_close(struct io_kiocb *req, struct io_kiocb **nxt, ...@@ -3055,6 +3046,14 @@ static int io_close(struct io_kiocb *req, struct io_kiocb **nxt,
*/ */
io_queue_async_work(req); io_queue_async_work(req);
return 0; return 0;
}
/*
* No ->flush(), safely close from here and just punt the
* fput() to async context.
*/
__io_close_finish(req, nxt);
return 0;
} }
static int io_prep_sfr(struct io_kiocb *req, const struct io_uring_sqe *sqe) static int io_prep_sfr(struct io_kiocb *req, const struct io_uring_sqe *sqe)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册