Whamcloud - gitweb
LU-4540 llite: deadlock for page write
[fs/lustre-release.git] / lustre / llite / rw26.c
index 9365c74..447dc43 100644 (file)
@@ -546,7 +546,8 @@ 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 == NULL || PageDirty(vmpage))) {
+       if (unlikely(vmpage == NULL ||
+                    PageDirty(vmpage) || PageWriteback(vmpage))) {
                struct ccc_io *cio = ccc_env_io(env);
                struct cl_page_list *plist = &cio->u.write.cui_queue;
 
@@ -555,7 +556,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
                 * because it holds page lock of a dirty page and request for
                 * more grants. It's okay for the dirty page to be the first
                 * one in commit page list, though. */
-               if (vmpage != NULL && PageDirty(vmpage) && plist->pl_nr > 0) {
+               if (vmpage != NULL && plist->pl_nr > 0) {
                        unlock_page(vmpage);
                        page_cache_release(vmpage);
                        vmpage = NULL;