Skip to content

Commit 8ae757e

Browse files
committed
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"
2 parents aa0c38c + 8fdd60f commit 8ae757e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

fs/ext4/fsync.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,18 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
116116
goto out;
117117
}
118118

119-
ret = file_write_and_wait_range(file, start, end);
120-
if (ret)
121-
return ret;
122-
123119
if (!journal) {
124-
struct writeback_control wbc = {
125-
.sync_mode = WB_SYNC_ALL
126-
};
127-
128-
ret = ext4_write_inode(inode, &wbc);
120+
ret = __generic_file_fsync(file, start, end, datasync);
129121
if (!ret)
130122
ret = ext4_sync_parent(inode);
131123
if (test_opt(inode->i_sb, BARRIER))
132124
goto issue_flush;
133125
goto out;
134126
}
135127

128+
ret = file_write_and_wait_range(file, start, end);
129+
if (ret)
130+
return ret;
136131
/*
137132
* data=writeback,ordered:
138133
* The caller's filemap_fdatawrite()/wait will sync the data.

0 commit comments

Comments
 (0)