[LU-15399] Don't restart CLI IO for IOCB_NOWAIT direct IO Created: 27/Dec/21  Updated: 27/Nov/23  Resolved: 11/Jul/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.16.0

Type: Bug Priority: Minor
Reporter: Qian Yingjin Assignee: Qian Yingjin
Resolution: Fixed Votes: 0
Labels: MON

Issue Links:
Related
is related to LU-15994 Fio io_uring failed with error=interr... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   
int cl_io_loop(const struct lu_env *env, struct cl_io *io)
{
	int result = 0;
	int rc = 0;

       ...
      if (result == -EAGAIN && io->ci_ndelay) {
		io->ci_need_restart = 1;
		result = 0;
	}

	if (result == 0)
		result = io->ci_result;
	RETURN(result < 0 ? result : 0);
}
EXPORT_SYMBOL(cl_io_loop);
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;
               ...

We should handle FLR mirror retry and io_uring IOCB_NOWAIT differently.

In the current code, it will restart the I/O engine loop when get -EAGAIN return code.
When io_uring with IOCB_NOWAIT flags and found there are page cache in the I/O range, we should return the -EAGAIN to the caller immediately.
Otherwise, it will Stuck in an endless loop。



 Comments   
Comment by Gerrit Updater [ 17/Jan/22 ]

"Yingjin Qian <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/46147
Subject: LU-15399 llite: dont restart directIO with IOCB_NOWAIT
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 07d7db274e9f906d77274298d83775425cab8f3a

Comment by Gerrit Updater [ 11/Jul/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/46147/
Subject: LU-15399 llite: dont restart directIO with IOCB_NOWAIT
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 8db455c77265063a10a9d08147b8fd4ed20c59c4

Comment by Peter Jones [ 11/Jul/22 ]

Landed for 2.16

Comment by Gerrit Updater [ 27/Nov/23 ]

"Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53246
Subject: LU-15399 llite: dont restart directIO with IOCB_NOWAIT
Project: fs/lustre-release
Branch: b2_15
Current Patch Set: 1
Commit: ebb2ac34de76fa43bd1de44de712f34362117ece

Generated at Sat Feb 10 03:17:59 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.