From: Jinshan Xiong Date: Thu, 10 Apr 2014 15:40:49 +0000 (-0400) Subject: LU-4873 llite: avoid a deadlock in page write X-Git-Tag: 2.5.58~23 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=50eeb38a8c1ca26c5837149aa442288af8d4fc45;p=fs%2Flustre-release.git LU-4873 llite: avoid a deadlock in page write For a partial page write, it will have to issue a READ RPC firstly to get a full uptodate page. If another page is already locked by this thread it can easily cause deadlock. Signed-off-by: Jinshan Xiong Change-Id: I3bf01b51c8842666dfb923b9df073acbcc533950 Reviewed-on: http://review.whamcloud.com/9928 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 77151de..64a06f9 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -554,8 +554,9 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, env = lcc->lcc_env; io = lcc->lcc_io; - /* To avoid deadlock, try to lock page first. */ - vmpage = grab_cache_page_nowait(mapping, index); + if (likely(to == PAGE_SIZE)) /* LU-4873 */ + /* To avoid deadlock, try to lock page first. */ + vmpage = grab_cache_page_nowait(mapping, index); if (unlikely(vmpage == NULL || PageDirty(vmpage) || PageWriteback(vmpage))) { struct ccc_io *cio = ccc_env_io(env);