From 9053bd5f4b4a3b822bb38125f6c670174903c436 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 3b4d807..2fe44e8 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -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; -- 1.8.3.1