Whamcloud - gitweb
LU-14760 llite: restart clio for AIO if necessary
authorLi Dongyang <dongyangli@ddn.com>
Mon, 14 Jun 2021 01:31:33 +0000 (11:31 +1000)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 10 Mar 2023 19:50:29 +0000 (19:50 +0000)
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.

Lustre-change: https://review.whamcloud.com/43995
Lustre-commit: TBD (from cf20b7fffa211b5093a2d698df6162f5ddf575a4)

Change-Id: Iccca31b032b01b940656864bfff22a821ff5061d
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/47407
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/file.c

index 578477f..6022548 100644 (file)
@@ -1661,6 +1661,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
        ssize_t result = 0;
        int rc = 0;
        int rc2 = 0;
+       int retries = 1000;
        unsigned int retried = 0, dio_lock = 0;
        bool is_aio = false;
        bool is_parallel_dio = false;
@@ -1818,13 +1819,13 @@ out:
               file->f_path.dentry->d_name.name,
               iot, rc, result, io->ci_need_restart);
 
-       if ((rc == 0 || 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, ret: %zd, rc: %d\n",
+                      "%s: restart %s from %lld, count: %zu, retries: %d, ret: %zd, rc: %d\n",
                       file_dentry(file)->d_name.name,
                       iot == CIT_READ ? "read" : "write",
-                      *ppos, count, result, rc);
+                      *ppos, count, retries, result, rc);
                /* preserve the tried count for FLR */
                retried = io->ci_ndelay_tried;
                dio_lock = io->ci_dio_lock;