Skip to content

Commit 6ad7f23

Browse files
isilenceaxboe
authored andcommitted
io_uring: clear F_REISSUE right after getting it
There are lots of ways r/w request may continue its path after getting REQ_F_REISSUE, it's not necessarily io-wq and can be, e.g. apoll, and submitted via io_async_task_func() -> __io_req_task_submit() Clear the flag right after getting it, so the next attempt is well prepared regardless how the request will be executed. Fixes: 230d50d ("io_uring: move reissue into regular IO path") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/11dcead939343f4e27cab0074d34afcab771bfa4.1617842918.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent e82ad48 commit 6ad7f23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/io_uring.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,6 +3294,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
32943294
ret = io_iter_do_read(req, iter);
32953295

32963296
if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) {
3297+
req->flags &= ~REQ_F_REISSUE;
32973298
/* IOPOLL retry should happen for io-wq threads */
32983299
if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL))
32993300
goto done;
@@ -3417,8 +3418,10 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
34173418
else
34183419
ret2 = -EINVAL;
34193420

3420-
if (req->flags & REQ_F_REISSUE)
3421+
if (req->flags & REQ_F_REISSUE) {
3422+
req->flags &= ~REQ_F_REISSUE;
34213423
ret2 = -EAGAIN;
3424+
}
34223425

34233426
/*
34243427
* Raw bdev writes will return -EOPNOTSUPP for IOCB_NOWAIT. Just
@@ -6173,7 +6176,6 @@ static void io_wq_submit_work(struct io_wq_work *work)
61736176
ret = -ECANCELED;
61746177

61756178
if (!ret) {
6176-
req->flags &= ~REQ_F_REISSUE;
61776179
do {
61786180
ret = io_issue_sqe(req, 0);
61796181
/*

0 commit comments

Comments
 (0)