diff options
author | Jinshan Xiong <jinshan.xiong@intel.com> | 2016-08-16 20:18:44 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-21 13:57:35 (GMT) |
commit | 91196c20a37bb5990e4358ff97dbeb2bd3007154 (patch) | |
tree | f633c8e53d446e7dbe4837d7d109702c39f991e1 /drivers/staging/lustre | |
parent | 9b58714f9ab4138dabcf7176fdc465bd00afeae9 (diff) | |
download | linux-91196c20a37bb5990e4358ff97dbeb2bd3007154.tar.xz |
staging: lustre: 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 <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4873
Reviewed-on: http://review.whamcloud.com/9928
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r-- | drivers/staging/lustre/lustre/llite/rw26.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index d98c7ac..c14a1b6 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -506,8 +506,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 || PageDirty(vmpage) || PageWriteback(vmpage))) { struct vvp_io *vio = vvp_env_io(env); struct cl_page_list *plist = &vio->u.write.vui_queue; |