aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 7332194d7afd..c11418dd94e8 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1851,8 +1851,11 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
1851 * i_sem is held, which protects generic_osync_inode() from 1851 * i_sem is held, which protects generic_osync_inode() from
1852 * livelocking. 1852 * livelocking.
1853 */ 1853 */
1854 if (written >= 0 && file->f_flags & O_SYNC) 1854 if (written >= 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) {
1855 generic_osync_inode(inode, mapping, OSYNC_METADATA); 1855 int err = generic_osync_inode(inode, mapping, OSYNC_METADATA);
1856 if (err < 0)
1857 written = err;
1858 }
1856 if (written == count && !is_sync_kiocb(iocb)) 1859 if (written == count && !is_sync_kiocb(iocb))
1857 written = -EIOCBQUEUED; 1860 written = -EIOCBQUEUED;
1858 return written; 1861 return written;
@@ -1951,7 +1954,9 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
1951 if (unlikely(nr_segs > 1)) { 1954 if (unlikely(nr_segs > 1)) {
1952 filemap_set_next_iovec(&cur_iov, 1955 filemap_set_next_iovec(&cur_iov,
1953 &iov_base, status); 1956 &iov_base, status);
1954 buf = cur_iov->iov_base + iov_base; 1957 if (count)
1958 buf = cur_iov->iov_base +
1959 iov_base;
1955 } else { 1960 } else {
1956 iov_base += status; 1961 iov_base += status;
1957 } 1962 }