From a8dd381b912e1ad63ac2fc3f89ed4404aa2d1c7f Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 8 Apr 2015 09:43:50 +1000 Subject: [PATCH] fs/ext4/fsync.c: generic_file_fsync call based on barrier flag generic_file_fsync has been updated to issue a flush for older filesystems. This patch tests for barrier flag in ext4 mount flags and calls the right function. Lukas said: : Note that the actual generic_file_fsync change fixes a real bug in ext4 : where we would _not_ send a flush on sync if we have file system : without journal. : : Ted, it would be useful to mention that in the commit description : along with the commit id: : : ac13a829f6adb674015ab399594c089990104af7 fs/libfs.c: add generic : data flush to fsync Signed-off-by: Fabian Frederick Suggested-by: Jan Kara Suggested-by: Christoph Hellwig Reviewed-by: Lukas Czerner Cc: Jan Kara Cc: Christoph Hellwig Cc: Alexander Viro Cc: "Theodore Ts'o" Signed-off-by: Andrew Morton --- fs/ext4/fsync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index a8bc47f75fa0..5b6e9f246233 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -107,7 +107,10 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) } if (!journal) { - ret = generic_file_fsync(file, start, end, datasync); + if (test_opt(inode->i_sb, BARRIER)) + ret = generic_file_fsync(file, start, end, datasync); + else + ret = __generic_file_fsync(file, start, end, datasync); if (!ret && !hlist_empty(&inode->i_dentry)) ret = ext4_sync_parent(inode); goto out; -- 2.39.5