io_uring: re-issue block requests that failed because of resources
authorJens Axboe <axboe@kernel.dk>
Thu, 4 Jun 2020 17:28:00 +0000 (11:28 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 18 Jun 2020 14:40:45 +0000 (08:40 -0600)
commit99b891aaa7fdadfe4bfaa40eb6567e60b9539fe5
treea5f0bf31168295f5d8ce8938f2a77f577bf1e257
parent6c8b94477e9812797905c17ea418c04a42cb16c9
io_uring: re-issue block requests that failed because of resources

Mark the plug with nowait == true, which will cause requests to avoid
blocking on request allocation. If they do, we catch them and reissue
them from a task_work based handler.

Normally we can catch -EAGAIN directly, but the hard case is for split
requests. As an example, the application issues a 512KB request. The
block core will split this into 128KB if that's the max size for the
device. The first request issues just fine, but we run into -EAGAIN for
some latter splits for the same request. As the bio is split, we don't
get to see the -EAGAIN until one of the actual reads complete, and hence
we cannot handle it inline as part of submission.

This does potentially cause re-reads of parts of the range, as the whole
request is reissued. There's currently no better way to handle this.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c