]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: retry in case of short read on block device
authorMing Lei <ming.lei@redhat.com>
Sat, 21 Aug 2021 15:07:51 +0000 (23:07 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 31 Aug 2021 17:45:30 +0000 (11:45 -0600)
commit45dd6c1361aa302c1bf7589d812e24b577eeb963
tree825d4a7a4c170901a07bb8715c5b875ab32547c5
parenta9d3ca6c9bef437c8c1aec52ae682fb2a64e7500
io_uring: retry in case of short read on block device

In case of buffered reading from block device, when short read happens,
we should retry to read more, otherwise the IO will be completed
partially, for example, the following fio expects to read 2MB, but it
can only read 1M or less bytes:

    fio --name=onessd --filename=/dev/nvme0n1 --filesize=2M \
--rw=randread --bs=2M --direct=0 --overwrite=0 --numjobs=1 \
--iodepth=1 --time_based=0 --runtime=2 --ioengine=io_uring \
--registerfiles --fixedbufs --gtod_reduce=1 --group_reporting

Fix the issue by allowing short read retry for block device, which sets
FMODE_BUF_RASYNC really.

Fixes: ca1377b39de6 ("io_uring: fix short read retries for non-reg files")
Cc: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/20210821150751.1290434-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c