Commit 9fefd491 authored by Jens Axboe's avatar Jens Axboe Committed by Laibin Qiu
Browse files

io_uring: re-issue block requests that failed because of resources

mainline inclusion
from mainline-v5.9-rc1
commit b63534c4
category: bugfix
bugzilla: 186136, https://gitee.com/openeuler/kernel/issues/I4RM1D


CVE: NA

-------------------------------------------------

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: default avatarJens Axboe <axboe@kernel.dk>
conflict:
        fs/io_uring.c
Adding nowait to plug list is reverted in (62c774ed ("io_uring: don't
unconditionally set plug->nowait = true"))
Signed-off-by: default avatarLaibin Qiu <qiulaibin@huawei.com>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
parent 98aa2e7e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment