Whamcloud - gitweb
LU-4873 llite: avoid a deadlock in page write 28/9928/2
authorJinshan Xiong <jinshan.xiong@intel.com>
Thu, 10 Apr 2014 15:40:49 +0000 (11:40 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 17 Apr 2014 03:45:39 +0000 (03:45 +0000)
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 <jinshan.xiong@intel.com>
Change-Id: I3bf01b51c8842666dfb923b9df073acbcc533950
Reviewed-on: http://review.whamcloud.com/9928
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/rw26.c

index 77151de..64a06f9 100644 (file)
@@ -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);