diff mbox series

[04/27] lustre: llite: restart clio for AIO if necessary

Message ID 1681739243-29375-5-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to OpenSFS branch April 17, 2023 | expand

Commit Message

James Simmons April 17, 2023, 1:47 p.m. UTC
From: Li Dongyang <dongyangli@ddn.com>

If the clio needs to be restarted from where it left off,
do it for AIO as well, so we don't end up with short IO.
Limit thr number of retries to 1000, to avoid potential
issues if the loop is stuck forever.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14760
Lustre-commit: 6b1e747ad5bf02915 ("LU-14760 llite: restart clio for AIO if necessary")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/43995
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/file.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index 746c18f..b96efb1 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -1689,6 +1689,7 @@  static void ll_heat_add(struct inode *inode, enum cl_io_type iot,
 	ssize_t result = 0;
 	int rc = 0;
 	int rc2 = 0;
+	int retries = 1000;
 	unsigned int retried = 0;
 	unsigned int dio_lock = 0;
 	bool is_aio = false;
@@ -1851,13 +1852,13 @@  static void ll_heat_add(struct inode *inode, enum cl_io_type iot,
 	       file->f_path.dentry->d_name.name,
 	       iot, rc, result, io->ci_need_restart);
 
-	if ((!rc || rc == -ENODATA || rc == -ENOLCK) &&
-	    count > 0 && io->ci_need_restart) {
+	if ((!rc || rc == -ENODATA || rc == -ENOLCK || rc == -EIOCBQUEUED) &&
+	    count > 0 && io->ci_need_restart && retries-- > 0) {
 		CDEBUG(D_VFSTRACE,
-		       "%s: restart %s from %lld, count:%zu, result: %zd\n",
+		       "%s: restart %s from ppos=%lld count=%zu retries=%u ret=%zd: rc = %d\n",
 		       file_dentry(file)->d_name.name,
 		       iot == CIT_READ ? "read" : "write",
-		       *ppos, count, result);
+		       *ppos, count, retries, result, rc);
 		/* preserve the tried count for FLR */
 		retried = io->ci_ndelay_tried;
 		dio_lock = io->ci_dio_lock;