Whamcloud - gitweb
b=16424
[fs/lustre-release.git] / lustre / obdclass / cl_page.c
index feac1ff..5dcf62d 100644 (file)
@@ -320,7 +320,7 @@ static int cl_page_alloc(const struct lu_env *env, struct cl_object *o,
 
         ENTRY;
         result = +1;
-        OBD_SLAB_ALLOC_PTR(page, cl_page_kmem);
+        OBD_SLAB_ALLOC_PTR_GFP(page, cl_page_kmem, CFS_ALLOC_IO);
         if (page != NULL) {
                 atomic_set(&page->cp_ref, 1);
                 page->cp_obj = o;
@@ -1249,7 +1249,7 @@ void cl_page_completion(const struct lu_env *env,
 
         ENTRY;
         CL_PAGE_HEADER(D_TRACE, env, pg, "%i %i\n", crt, ioret);
-        if (crt == CRT_READ) {
+        if (crt == CRT_READ && ioret == 0) {
                 PASSERT(env, pg, !(pg->cp_flags & CPF_READ_COMPLETED));
                 pg->cp_flags |= CPF_READ_COMPLETED;
         }
@@ -1259,7 +1259,12 @@ void cl_page_completion(const struct lu_env *env,
                                (const struct lu_env *,
                                 const struct cl_page_slice *, int), ioret);
 
-        KLASSERT(!PageWriteback(cl_page_vmpage(env, pg)));
+        /* Don't assert the page writeback bit here because the lustre file
+         * may be as a backend of swap space. in this case, the page writeback
+         * is set by VM, and obvious we shouldn't clear it at all. Fortunately
+         * this type of pages are all TRANSIENT pages. */
+        KLASSERT(ergo(pg->cp_type == CPT_CACHEABLE,
+                      !PageWriteback(cl_page_vmpage(env, pg))));
         EXIT;
 }
 EXPORT_SYMBOL(cl_page_completion);