mmc: sdhci-of-arasan: keep consistent with upstream
[firefly-linux-kernel-4.4.55.git] / fs / fs-writeback.c
index 7378169e90be6ed485ac48d0cf633c8e37c4c3d2..28cd6508f4aab3eda6aa689668daa74ec690df7a 100644 (file)
@@ -1981,9 +1981,9 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
  * page->mapping->host, so the page-dirtying time is recorded in the internal
  * blockdev inode.
  */
-#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
 void __mark_inode_dirty(struct inode *inode, int flags)
 {
+#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
        struct super_block *sb = inode->i_sb;
        int dirtytime;
 
@@ -2015,7 +2015,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
            (dirtytime && (inode->i_state & I_DIRTY_INODE)))
                return;
 
-       if (unlikely(block_dump))
+       if (unlikely(block_dump > 1))
                block_dump___mark_inode_dirty(inode);
 
        spin_lock(&inode->i_lock);
@@ -2093,6 +2093,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
 out_unlock_inode:
        spin_unlock(&inode->i_lock);
 
+#undef I_DIRTY_INODE
 }
 EXPORT_SYMBOL(__mark_inode_dirty);
 
@@ -2149,7 +2150,12 @@ static void wait_sb_inodes(struct super_block *sb)
                iput(old_inode);
                old_inode = inode;
 
-               filemap_fdatawait(mapping);
+               /*
+                * We keep the error status of individual mapping so that
+                * applications can catch the writeback error using fsync(2).
+                * See filemap_fdatawait_keep_errors() for details.
+                */
+               filemap_fdatawait_keep_errors(mapping);
 
                cond_resched();