Skip to content

Commit

Permalink
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/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"
  • Loading branch information
Linus Torvalds committed Feb 12, 2019
2 parents aa0c38c + 8fdd60f commit 8ae757e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions fs/ext4/fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,18 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
goto out;
}

ret = file_write_and_wait_range(file, start, end);
if (ret)
return ret;

if (!journal) {
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL
};

ret = ext4_write_inode(inode, &wbc);
ret = __generic_file_fsync(file, start, end, datasync);
if (!ret)
ret = ext4_sync_parent(inode);
if (test_opt(inode->i_sb, BARRIER))
goto issue_flush;
goto out;
}

ret = file_write_and_wait_range(file, start, end);
if (ret)
return ret;
/*
* data=writeback,ordered:
* The caller's filemap_fdatawrite()/wait will sync the data.
Expand Down

0 comments on commit 8ae757e

Please sign in to comment.