Whamcloud - gitweb
LU-9771 flr: read support for flr
[fs/lustre-release.git] / lustre / llite / glimpse.c
index 7c9ec0d..94467aa 100644 (file)
@@ -187,27 +187,31 @@ int cl_glimpse_size0(struct inode *inode, int agl)
         struct lu_env          *env = NULL;
         struct cl_io           *io  = NULL;
        __u16                   refcheck;
-        int                     result;
+       int                     retried = 0;
+       int                     result;
 
-        ENTRY;
+       ENTRY;
 
        result = cl_io_get(inode, &env, &io, &refcheck);
        if (result <= 0)
                RETURN(result);
 
        do {
-               io->ci_need_restart = 0;
-               io->ci_verify_layout = 1;
+               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,
+               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);
+                       if (!agl && result == -EWOULDBLOCK)
+                               io->ci_need_restart = 1;
+               }
 
                OBD_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, 2);
                cl_io_fini(env, io);