Whamcloud - gitweb
LU-3409 llite: silence lockdep warning in ll_md_blocking_ast
[fs/lustre-release.git] / lustre / llite / llite_mmap.c
index ba845d1..febad1d 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -192,11 +192,6 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
        if (result < 0)
                GOTO(out, result);
 
-       /* Don't enqueue new locks for page_mkwrite().
-        * If the lock has been cancelled then page must have been
-        * truncated, in that case, kernel will handle it.
-        */
-       io->ci_lockreq = CILR_PEEK;
        io->u.ci_fault.ft_mkwrite = 1;
        io->u.ci_fault.ft_writable = 1;
 
@@ -219,11 +214,10 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
 
        cfs_restore_sigs(set);
 
-        if (result == -ENODATA) /* peek failed, no lock caching. */
-                CDEBUG(D_MMAP, "race on page_mkwrite: %lx (%lu %p)\n",
-                       vma->vm_flags, io->u.ci_fault.ft_index, vmpage);
+        if (result == 0) {
+               struct inode *inode = vma->vm_file->f_dentry->d_inode;
+               struct ll_inode_info *lli = ll_i2info(inode);
 
-        if (result == 0 || result == -ENODATA) {
                 lock_page(vmpage);
                 if (vmpage->mapping == NULL) {
                         unlock_page(vmpage);
@@ -233,18 +227,6 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
                          * to handle_mm_fault(). */
                         if (result == 0)
                                 result = -ENODATA;
-                } else if (result == -ENODATA) {
-                        /* Invalidate it if the cl_lock is being revoked.
-                         * This piece of code is definitely needed for RHEL5,
-                         * otherwise, SIGBUS will be wrongly returned to
-                         * applications. */
-                        write_one_page(vmpage, 1);
-                        lock_page(vmpage);
-                        if (vmpage->mapping != NULL) {
-                                ll_invalidate_page(vmpage);
-                                LASSERT(vmpage->mapping == NULL);
-                        }
-                        unlock_page(vmpage);
                 } else if (!PageDirty(vmpage)) {
                         /* race, the page has been cleaned by ptlrpcd after
                          * it was unlocked, it has to be added into dirty
@@ -261,6 +243,12 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
                         *retry = true;
                         result = -EAGAIN;
                 }
+
+               if (result == 0) {
+                       spin_lock(&lli->lli_lock);
+                       lli->lli_flags |= LLIF_DATA_MODIFIED;
+                       spin_unlock(&lli->lli_lock);
+               }
         }
         EXIT;