]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix async buffered reads when readahead is disabled
authorHao Xu <haoxu@linux.alibaba.com>
Tue, 29 Sep 2020 12:00:45 +0000 (20:00 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 Sep 2020 13:54:00 +0000 (07:54 -0600)
commit53ace268521e3428fbdd22a6ada2053d7139b2eb
treeae6e8870004473d388c5f3275ad7888b6f74ec01
parent6cde5279e52a4372c73eb39e88f9ce6c969f7270
io_uring: fix async buffered reads when readahead is disabled

The async buffered reads feature is not working when readahead is
turned off. There are two things to concern:

- when doing retry in io_read, not only the IOCB_WAITQ flag but also
  the IOCB_NOWAIT flag is still set, which makes it goes to would_block
  phase in generic_file_buffered_read() and then return -EAGAIN. After
  that, the io-wq thread work is queued, and later doing the async
  reads in the old way.

- even if we remove IOCB_NOWAIT when doing retry, the feature is still
  not running properly, since in generic_file_buffered_read() it goes to
  lock_page_killable() after calling mapping->a_ops->readpage() to do
  IO, and thus causing process to sleep.

Fixes: a3599590024a ("mm: support async buffered reads in generic_file_buffered_read()")
Fixes: 5720ca70a204 ("io_uring: get rid of kiocb_wait_page_queue_init()")
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
mm/filemap.c