aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinshan Xiong <[email protected]>2016-03-30 19:48:43 -0400
committerGreg Kroah-Hartman <[email protected]>2016-03-30 21:38:13 -0700
commitd37dd10b71fd304289560901e81eddbe7defb351 (patch)
treee007c2eb9bdad906102f26230ebc7504af2a20aa
parentc11599b8d52d353f45b2dc05d58c48f9812ce6e9 (diff)
staging/lustre/llite: deadlock for page write
Writing thread already locked page #1, and then wait for the Writeback bit of page #2; Ptlrpc thread is composing a write RPC, so it sets Writeback on page #2 and tries to lock page #1 to make it ready. Deadlocked. Signed-off-by: Jinshan Xiong <[email protected]> Reviewed-on: http://review.whamcloud.com/9036 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4540 Reviewed-by: wangdi <[email protected]> Signed-off-by: Oleg Drokin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/lustre/lustre/llite/rw26.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c
index 50d8289afe06..f87238b3373c 100644
--- a/drivers/staging/lustre/lustre/llite/rw26.c
+++ b/drivers/staging/lustre/lustre/llite/rw26.c
@@ -512,7 +512,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
/* To avoid deadlock, try to lock page first. */
vmpage = grab_cache_page_nowait(mapping, index);
- if (unlikely(!vmpage || PageDirty(vmpage))) {
+ if (unlikely(!vmpage || PageDirty(vmpage) || PageWriteback(vmpage))) {
struct ccc_io *cio = ccc_env_io(env);
struct cl_page_list *plist = &cio->u.write.cui_queue;
@@ -522,7 +522,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
* more grants. It's okay for the dirty page to be the first
* one in commit page list, though.
*/
- if (vmpage && PageDirty(vmpage) && plist->pl_nr > 0) {
+ if (vmpage && plist->pl_nr > 0) {
unlock_page(vmpage);
page_cache_release(vmpage);
vmpage = NULL;