- /*
- * We don't need ast_flags argument to cl_glimpse_size(), because
- * osc_lock_enqueue() takes care of the possible deadlock that said
- * argument was introduced to avoid.
- */
- /*
- * XXX but note that ll_file_seek() passes LDLM_FL_BLOCK_NOWAIT to
- * cl_glimpse_size(), which doesn't make sense: glimpse locks are not
- * blocking anyway.
- */
- struct lu_env *env = NULL;
- struct cl_io *io = NULL;
- __u16 refcheck;
- int result;
-
- ENTRY;
-
- result = cl_io_get(inode, &env, &io, &refcheck);
- if (result > 0) {
- again:
- io->ci_verify_layout = 1;
- result = cl_io_init(env, io, CIT_MISC, io->ci_obj);
- if (result > 0)
- /*
- * nothing to do for this io. This currently happens
- * when stripe sub-object's are not yet created.
- */
- result = io->ci_result;
- else if (result == 0)
- result = cl_glimpse_lock(env, io, inode, io->ci_obj,
- agl);
-
- OBD_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, 2);
- cl_io_fini(env, io);
- if (unlikely(io->ci_need_restart))
- goto again;
- cl_env_put(env, &refcheck);
- }
+ /*
+ * We don't need ast_flags argument to cl_glimpse_size(), because
+ * osc_lock_enqueue() takes care of the possible deadlock that said
+ * argument was introduced to avoid.
+ */
+ /*
+ * XXX but note that ll_file_seek() passes LDLM_FL_BLOCK_NOWAIT to
+ * cl_glimpse_size(), which doesn't make sense: glimpse locks are not
+ * blocking anyway.
+ */
+ struct lu_env *env = NULL;
+ struct cl_io *io = NULL;
+ u16 refcheck;
+ int retried = 0;
+ int result;
+
+ ENTRY;
+
+ result = cl_io_get(inode, &env, &io, &refcheck);
+ if (result <= 0)
+ RETURN(result);
+
+ do {
+ io->ci_ndelay_tried = retried++;
+ io->ci_ndelay = io->ci_verify_layout = 1;
+ result = cl_io_init(env, io, CIT_GLIMPSE, io->ci_obj);
+ if (result > 0) {
+ /*
+ * nothing to do for this io. This currently happens
+ * when stripe sub-object's are not yet created.
+ */
+ result = io->ci_result;
+ } else if (result == 0) {
+ result = cl_glimpse_lock(env, io, inode, io->ci_obj,
+ agl);
+ /**
+ * need to limit retries for FLR mirrors if fast read
+ * is short because of concurrent truncate.
+ */
+ if (!agl && result == -EAGAIN &&
+ !io->ci_tried_all_mirrors)
+ io->ci_need_restart = 1;
+ }
+
+ CFS_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, cfs_fail_val ?: 4);
+ cl_io_fini(env, io);
+ } while (unlikely(io->ci_need_restart));
+
+ cl_env_put(env, &refcheck);