Whamcloud - gitweb
LU-1442 llite: cleanup if a page failed to add into cache
authorJinshan Xiong <jinshan.xiong@whamcloud.com>
Mon, 23 Jul 2012 14:09:51 +0000 (22:09 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 28 Jul 2012 05:01:42 +0000 (01:01 -0400)
In lustre, we assume that a dirty page must be queued in osc cache
for writing. However, in vvp_io_commit_write(), if a page failed to
add into cache, page dirty flag isn't cleared this will cause the
page will never be added into cache again.

Signed-off-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Change-Id: I1c132c6f1d4f5845682e51850eb895b292fc5f0d
Reviewed-on: http://review.whamcloud.com/3447
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/llite/vvp_io.c

index 3b4d807..2fe44e8 100644 (file)
@@ -977,13 +977,12 @@ static int vvp_io_commit_write(const struct lu_env *env,
          */
         if (!PageDirty(vmpage)) {
                 tallyop = LPROC_LL_DIRTY_MISSES;
-                vvp_write_pending(cl2ccc(obj), cp);
-                set_page_dirty(vmpage);
-                /* ll_set_page_dirty() does the same for now, but
-                 * it will not soon. */
-                vvp_write_pending(cl2ccc(obj), cp);
                 result = cl_page_cache_add(env, io, pg, CRT_WRITE);
-                if (result == -EDQUOT) {
+                if (result == 0) {
+                        /* page was added into cache successfully. */
+                        set_page_dirty(vmpage);
+                        vvp_write_pending(cl2ccc(obj), cp);
+                } else if (result == -EDQUOT) {
                         pgoff_t last_index = i_size_read(inode) >> CFS_PAGE_SHIFT;
                         bool need_clip = true;