Whamcloud - gitweb
LU-15399 llite: dont restart directIO with IOCB_NOWAIT 47/46147/3
authorQian Yingjin <qian@ddn.com>
Mon, 27 Dec 2021 03:23:45 +0000 (11:23 +0800)
committerQian Yingjin <qian@ddn.com>
Wed, 22 Jun 2022 09:14:16 +0000 (05:14 -0400)
commitf2aeedc5b188ea00f2e05671abb2adae5fadcf6e
treeec6d2bb4d3f5ed5cdc18bd4d20f42352c81eb610
parentc4ebdc96061ae9c24ac471b2866f2087bc3e98d4
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.

Test-Parameters: clientdistro=ubuntu2004 testlist=sanity-pcc
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Id4374382e56e90d02349676891aa57b216b3deff
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