Whamcloud - gitweb
LU-12142 clio: fix hang on urgent cached pages
[fs/lustre-release.git] / lustre / llite / vvp_io.c
index f36d036..e4faf2c 100644 (file)
@@ -818,6 +818,12 @@ static int vvp_io_read_start(const struct lu_env *env,
        if (!can_populate_pages(env, io, inode))
                RETURN(0);
 
+       if (!(file->f_flags & O_DIRECT)) {
+               result = cl_io_lru_reserve(env, io, pos, cnt);
+               if (result)
+                       RETURN(result);
+       }
+
        /* Unless this is reading a sparse file, otherwise the lock has already
         * been acquired so vvp_prep_size() is an empty op. */
        result = vvp_prep_size(env, obj, io, pos, cnt, &exceed);
@@ -1236,6 +1242,12 @@ static int vvp_io_write_start(const struct lu_env *env,
        if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_NOSEC) && lock_inode)
                RETURN(-EINVAL);
 
+       if (!(file->f_flags & O_DIRECT)) {
+               result = cl_io_lru_reserve(env, io, pos, cnt);
+               if (result)
+                       RETURN(result);
+       }
+
        if (vio->vui_iter == NULL) {
                /* from a temp io in ll_cl_init(). */
                result = 0;