mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-20 22:15:59 +00:00
io_uring: allow re-poll if we made progress
We currently check REQ_F_POLLED before arming async poll for a notification to retry. If it's set, then we don't allow poll and will punt to io-wq instead. This is done to prevent a situation where a buggy driver will repeatedly return that there's space/data available yet we get -EAGAIN. However, if we already transferred data, then it should be safe to rely on poll again. Gate the check on whether or not REQ_F_PARTIAL_IO is also set. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
4c3c09439c
commit
10c873334f
1 changed files with 7 additions and 3 deletions
|
@ -6266,7 +6266,9 @@ static int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
|
||||||
|
|
||||||
if (!def->pollin && !def->pollout)
|
if (!def->pollin && !def->pollout)
|
||||||
return IO_APOLL_ABORTED;
|
return IO_APOLL_ABORTED;
|
||||||
if (!file_can_poll(req->file) || (req->flags & REQ_F_POLLED))
|
if (!file_can_poll(req->file))
|
||||||
|
return IO_APOLL_ABORTED;
|
||||||
|
if ((req->flags & (REQ_F_POLLED|REQ_F_PARTIAL_IO)) == REQ_F_POLLED)
|
||||||
return IO_APOLL_ABORTED;
|
return IO_APOLL_ABORTED;
|
||||||
|
|
||||||
if (def->pollin) {
|
if (def->pollin) {
|
||||||
|
@ -6281,7 +6283,9 @@ static int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
|
||||||
}
|
}
|
||||||
if (def->poll_exclusive)
|
if (def->poll_exclusive)
|
||||||
mask |= EPOLLEXCLUSIVE;
|
mask |= EPOLLEXCLUSIVE;
|
||||||
if (!(issue_flags & IO_URING_F_UNLOCKED) &&
|
if (req->flags & REQ_F_POLLED) {
|
||||||
|
apoll = req->apoll;
|
||||||
|
} else if (!(issue_flags & IO_URING_F_UNLOCKED) &&
|
||||||
!list_empty(&ctx->apoll_cache)) {
|
!list_empty(&ctx->apoll_cache)) {
|
||||||
apoll = list_first_entry(&ctx->apoll_cache, struct async_poll,
|
apoll = list_first_entry(&ctx->apoll_cache, struct async_poll,
|
||||||
poll.wait.entry);
|
poll.wait.entry);
|
||||||
|
|
Loading…
Add table
Reference in a new issue