Whamcloud - gitweb
LU-3409 llite: silence lockdep warning in ll_md_blocking_ast
[fs/lustre-release.git] / lustre / llite / rw.c
index f8eb719..5b32414 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -237,18 +237,8 @@ int ll_prepare_write(struct file *file, struct page *vmpage, unsigned from,
                 struct cl_page *page = lcc->lcc_page;
 
                 cl_page_assume(env, io, page);
-                if (cl_io_is_append(io)) {
-                        struct cl_object   *obj   = io->ci_obj;
-                        struct inode       *inode = ccc_object_inode(obj);
-                        /**
-                         * In VFS file->page write loop, for appending, the
-                         * write offset might be reset according to the new
-                         * file size before holding i_mutex. So crw_pos should
-                         * be reset here. BUG:17711.
-                         */
-                        io->u.ci_wr.wr.crw_pos = i_size_read(inode);
-                }
-                result = cl_io_prepare_write(env, io, page, from, to);
+                
+               result = cl_io_prepare_write(env, io, page, from, to);
                 if (result == 0) {
                         /*
                          * Add a reference, so that page is not evicted from
@@ -1223,7 +1213,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)
                 * PageWriteback or clean the page. */
                result = cl_sync_file_range(inode, offset,
                                            offset + CFS_PAGE_SIZE - 1,
-                                           CL_FSYNC_LOCAL);
+                                           CL_FSYNC_LOCAL, 1);
                if (result > 0) {
                        /* actually we may have written more than one page.
                         * decreasing this page because the caller will count
@@ -1250,11 +1240,13 @@ out:
 int ll_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
        struct inode *inode = mapping->host;
+       struct ll_sb_info *sbi = ll_i2sbi(inode);
        loff_t start;
        loff_t end;
        enum cl_fsync_mode mode;
        int range_whole = 0;
        int result;
+       int ignore_layout = 0;
        ENTRY;
 
        if (wbc->range_cyclic) {
@@ -1273,7 +1265,12 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc)
        if (wbc->sync_mode == WB_SYNC_ALL)
                mode = CL_FSYNC_LOCAL;
 
-       result = cl_sync_file_range(inode, start, end, mode);
+       if (sbi->ll_umounting)
+               /* if the mountpoint is being umounted, all pages have to be
+                * evicted to avoid hitting LBUG when truncate_inode_pages()
+                * is called later on. */
+               ignore_layout = 1;
+       result = cl_sync_file_range(inode, start, end, mode, ignore_layout);
        if (result > 0) {
                wbc->nr_to_write -= result;
                result = 0;