From 7afc929a07efcbf33e27314776f057432f60b473 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Mon, 23 Jul 2012 22:09:51 +0800 Subject: [PATCH] LU-1442 llite: cleanup if a page failed to add into cache 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 Change-Id: I1c132c6f1d4f5845682e51850eb895b292fc5f0d Reviewed-on: http://review.whamcloud.com/3447 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Johann Lombardi --- lustre/llite/vvp_io.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 016b144..50a19c9 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -1000,13 +1000,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; @@ -1034,7 +1033,6 @@ static int vvp_io_commit_write(const struct lu_env *env, } if (need_clip) cl_page_clip(env, pg, 0, to); - clear_page_dirty_for_io(vmpage); result = vvp_page_sync_io(env, io, pg, cp, CRT_WRITE); if (result) CERROR("Write page %lu of inode %p failed %d\n", -- 1.8.3.1