Merge tag 'char-misc-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / fs / xfs / xfs_iops.c
index 4e00cf091d2ccac6b0a9e65113a67b2b5169f21f..d82efaa2ac7350553c8804c014c5f299809af178 100644 (file)
@@ -38,6 +38,7 @@
 #include "xfs_vnodeops.h"
 #include "xfs_inode_item.h"
 #include "xfs_trace.h"
+#include "xfs_icache.h"
 
 #include <linux/capability.h>
 #include <linux/xattr.h>
@@ -779,8 +780,8 @@ xfs_setattr_size(
         * care about here.
         */
        if (oldsize != ip->i_d.di_size && newsize > ip->i_d.di_size) {
-               error = xfs_flush_pages(ip, ip->i_d.di_size, newsize, 0,
-                                       FI_NONE);
+               error = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
+                                                     ip->i_d.di_size, newsize);
                if (error)
                        goto out_unlock;
        }
@@ -854,6 +855,9 @@ xfs_setattr_size(
                 * and do not wait the usual (long) time for writeout.
                 */
                xfs_iflags_set(ip, XFS_ITRUNCATED);
+
+               /* A truncate down always removes post-EOF blocks. */
+               xfs_inode_clear_eofblocks_tag(ip);
        }
 
        if (mask & ATTR_CTIME) {