Commit 8ae757ef authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 fix from Ted Ts'o:
 "Revert a commit which landed in v5.0-rc1 since it makes fsync in ext4
  nojournal mode unsafe"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  Revert "ext4: use ext4_write_inode() when fsyncing w/o a journal"
parents aa0c38cf 8fdd60f2
...@@ -116,16 +116,8 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -116,16 +116,8 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
goto out; goto out;
} }
ret = file_write_and_wait_range(file, start, end);
if (ret)
return ret;
if (!journal) { if (!journal) {
struct writeback_control wbc = { ret = __generic_file_fsync(file, start, end, datasync);
.sync_mode = WB_SYNC_ALL
};
ret = ext4_write_inode(inode, &wbc);
if (!ret) if (!ret)
ret = ext4_sync_parent(inode); ret = ext4_sync_parent(inode);
if (test_opt(inode->i_sb, BARRIER)) if (test_opt(inode->i_sb, BARRIER))
...@@ -133,6 +125,9 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -133,6 +125,9 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
goto out; goto out;
} }
ret = file_write_and_wait_range(file, start, end);
if (ret)
return ret;
/* /*
* data=writeback,ordered: * data=writeback,ordered:
* The caller's filemap_fdatawrite()/wait will sync the data. * The caller's filemap_fdatawrite()/wait will sync the data.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment