summaryrefslogtreecommitdiff
path: root/fs/libfs.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2017-07-06 07:02:29 -0400
committerJeff Layton <jlayton@redhat.com>2017-07-06 07:02:29 -0400
commit383aa543c2f46f245d652c0e5c77390f07ece657 (patch)
tree6525ad72a49001daa068ada2f20af62013a60dcb /fs/libfs.c
parent372cf243ea9a36d88ff67ae44f4512f64a6bca81 (diff)
downloadlwn-383aa543c2f46f245d652c0e5c77390f07ece657.tar.gz
lwn-383aa543c2f46f245d652c0e5c77390f07ece657.zip
fs: convert __generic_file_fsync to use errseq_t based reporting
Many simple, block-based filesystems use generic_file_fsync as their fsync operation. Some others (ext* and fat) also call this function to handle syncing out data. Switch this code over to use errseq_t based error reporting so that all of these filesystems get reliable error reporting via fsync, fdatasync and msync. Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r--fs/libfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/libfs.c b/fs/libfs.c
index 1b76f29799bf..3aabe553fc45 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -974,7 +974,7 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end,
int err;
int ret;
- err = filemap_write_and_wait_range(inode->i_mapping, start, end);
+ err = file_write_and_wait_range(file, start, end);
if (err)
return err;
@@ -991,9 +991,11 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end,
out:
inode_unlock(inode);
- /* must call this unconditionally as it clears AS_* error flags */
- err = filemap_check_errors(inode->i_mapping);
- return ret ? ret : err;
+ /* check and advance again to catch errors after syncing out buffers */
+ err = file_check_and_advance_wb_err(file);
+ if (ret == 0)
+ ret = err;
+ return ret;
}
EXPORT_SYMBOL(__generic_file_fsync);