Commit b5b0ecb7 authored by Jens Axboe's avatar Jens Axboe

io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return

The callback can only be armed, if we get -EIOCBQUEUED returned. It's
important that we clear the WAITQ bit for other cases, otherwise we can
queue for async retry and filemap will assume that we're armed and
return -EAGAIN instead of just blocking for the IO.

Cc: stable@vger.kernel.org # 5.9+
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ca0a2651
...@@ -3286,6 +3286,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) ...@@ -3286,6 +3286,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
if (ret == -EIOCBQUEUED) if (ret == -EIOCBQUEUED)
return 0; return 0;
/* we got some bytes, but not all. retry. */ /* we got some bytes, but not all. retry. */
kiocb->ki_flags &= ~IOCB_WAITQ;
} while (ret > 0 && ret < io_size); } while (ret > 0 && ret < io_size);
done: done:
kiocb_done(kiocb, ret, issue_flags); kiocb_done(kiocb, ret, issue_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment