aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs/file.c')
-rw-r--r--fs/ntfs/file.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index f4b1057abdd2..c587e2d27183 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -1832,9 +1832,8 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
1832 * fails again. 1832 * fails again.
1833 */ 1833 */
1834 if (unlikely(NInoTruncateFailed(ni))) { 1834 if (unlikely(NInoTruncateFailed(ni))) {
1835 down_write(&vi->i_alloc_sem); 1835 inode_dio_wait(vi);
1836 err = ntfs_truncate(vi); 1836 err = ntfs_truncate(vi);
1837 up_write(&vi->i_alloc_sem);
1838 if (err || NInoTruncateFailed(ni)) { 1837 if (err || NInoTruncateFailed(ni)) {
1839 if (!err) 1838 if (!err)
1840 err = -EIO; 1839 err = -EIO;
@@ -2153,12 +2152,19 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
2153 * with this inode but since we have no simple way of getting to them we ignore 2152 * with this inode but since we have no simple way of getting to them we ignore
2154 * this problem for now. 2153 * this problem for now.
2155 */ 2154 */
2156static int ntfs_file_fsync(struct file *filp, int datasync) 2155static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
2156 int datasync)
2157{ 2157{
2158 struct inode *vi = filp->f_mapping->host; 2158 struct inode *vi = filp->f_mapping->host;
2159 int err, ret = 0; 2159 int err, ret = 0;
2160 2160
2161 ntfs_debug("Entering for inode 0x%lx.", vi->i_ino); 2161 ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
2162
2163 err = filemap_write_and_wait_range(vi->i_mapping, start, end);
2164 if (err)
2165 return err;
2166 mutex_lock(&vi->i_mutex);
2167
2162 BUG_ON(S_ISDIR(vi->i_mode)); 2168 BUG_ON(S_ISDIR(vi->i_mode));
2163 if (!datasync || !NInoNonResident(NTFS_I(vi))) 2169 if (!datasync || !NInoNonResident(NTFS_I(vi)))
2164 ret = __ntfs_write_inode(vi, 1); 2170 ret = __ntfs_write_inode(vi, 1);
@@ -2176,6 +2182,7 @@ static int ntfs_file_fsync(struct file *filp, int datasync)
2176 else 2182 else
2177 ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " 2183 ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error "
2178 "%u.", datasync ? "data" : "", vi->i_ino, -ret); 2184 "%u.", datasync ? "data" : "", vi->i_ino, -ret);
2185 mutex_unlock(&vi->i_mutex);
2179 return ret; 2186 return ret;
2180} 2187}
2181 2188