From: Li Dongyang Date: Mon, 14 Jun 2021 01:31:33 +0000 (+1000) Subject: LU-14760 llite: restart clio for AIO if necessary X-Git-Tag: 2.15.55~77 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6b1e747ad5bf029150aa9d7c3e46d5b7b7cff78e;p=fs%2Flustre-release.git LU-14760 llite: restart clio for AIO if necessary 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. Change-Id: Iccca31b032b01b940656864bfff22a821ff5061d Signed-off-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/43995 Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e254b0b..3db2226 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1680,6 +1680,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; @@ -1839,13 +1840,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 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, rc); + *ppos, count, retries, result, rc); /* preserve the tried count for FLR */ retried = io->ci_ndelay_tried; dio_lock = io->ci_dio_lock;