diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index f15c13f97018..36861b7a6757 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1840,7 +1840,15 @@ int btrfs_release_file(struct inode *inode, struct file *filp) | |||
1840 | { | 1840 | { |
1841 | if (filp->private_data) | 1841 | if (filp->private_data) |
1842 | btrfs_ioctl_trans_end(filp); | 1842 | btrfs_ioctl_trans_end(filp); |
1843 | filemap_flush(inode->i_mapping); | 1843 | /* |
1844 | * ordered_data_close is set by settattr when we are about to truncate | ||
1845 | * a file from a non-zero size to a zero size. This tries to | ||
1846 | * flush down new bytes that may have been written if the | ||
1847 | * application were using truncate to replace a file in place. | ||
1848 | */ | ||
1849 | if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, | ||
1850 | &BTRFS_I(inode)->runtime_flags)) | ||
1851 | filemap_flush(inode->i_mapping); | ||
1844 | return 0; | 1852 | return 0; |
1845 | } | 1853 | } |
1846 | 1854 | ||