Whamcloud - gitweb
LU-15399 llite: dont restart directIO with IOCB_NOWAIT
authorQian Yingjin <qian@ddn.com>
Mon, 27 Dec 2021 03:23:45 +0000 (11:23 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 22 Jun 2022 18:50:30 +0000 (18:50 +0000)
commit84fbda529d8832f60f8ba5dc26f755e4834843ad
tree6fb5c460ff209297eb2df9a22be6a6e0e4cfab8a
parentdf00b02db4303f2a806c218c948175e02e096857
LU-15399 llite: dont restart directIO with IOCB_NOWAIT

It should hanlde FLR mirror retry and io_uring with IOCB_NOWAIT
flag differently.

int cl_io_loop(const struct lu_env *env, struct cl_io *io)
{
...
if (result == -EAGAIN && io->ci_ndelay) {
io->ci_need_restart = 1;
result = 0;
}
...
}

ssize_t
generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
{
...
if (iocb->ki_flags & IOCB_NOWAIT) {
if (filemap_range_has_page(mapping, iocb->ki_pos,
   iocb->ki_pos +
   count - 1))
return -EAGAIN;
...
}

In current code, it will restart I/O engine for read when get
-EAGAIN code.
However, for io_uring direct IO with IOCB_NOWAIT, if found that
there are cache pages in the current I/O range, it should return
-EAGAIN to the upper layer immediately. Otherwise, it will stuck
in an endless loop.

This patch also adds a tool "io_uring_probe" to check whether
the kernel supports io_uring fully.
The reason adding this check is because the rhel8.5 kernel has
backported io_uring:
cat /proc/kallsyms |grep io_uring
ffffffffa8510e10 W __x64_sys_io_uring_enter
ffffffffa8510e10 W __x64_sys_io_uring_register
ffffffffa8510e10 W __x64_sys_io_uring_setup
but the io_uring syscalls return -ENOSYS.

Lustre-change: https://review.whamcloud.com/46147/
Lustre-commit: TBD (from f2aeedc5b188ea00f2e05671abb2adae5fadcf6e)

Test-Parameters: clientdistro=ubuntu2004 testlist=sanity-pcc
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Id4374382e56e90d02349676891aa57b216b3deff
Reviewed-on: https://review.whamcloud.com/45941
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/cl_object.h
lustre/llite/file.c
lustre/obdclass/cl_io.c
lustre/tests/Makefile.am
lustre/tests/io_uring_probe.c [new file with mode: 0644]
lustre/tests/sanity-pcc.sh