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.
Unified · Split
| @@ -3286,6 +3286,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) · 3285 unmodified lines | |||
| 3286 | if (ret == -EIOCBQUEUED) | 3286 | if (ret == -EIOCBQUEUED) |
| 3287 | return 0; | 3287 | return 0; |
| 3288 | /* we got some bytes, but not all. retry. */ | 3288 | /* we got some bytes, but not all. retry. */ |
| 3289 | kiocb->ki_flags &= ~IOCB_WAITQ; | ||
| 3289 | } while (ret > 0 && ret < io_size); | 3290 | } while (ret > 0 && ret < io_size); |
| 3290 | done: | 3291 | done: |
| 3291 | kiocb_done(kiocb, ret, issue_flags); | 3292 | kiocb_done(kiocb, ret, issue_flags); |