diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 8d50879d1c2c68f23284314ff4fc7c5afe3c0a8e..a04a1ac4e0cfb10c109998b0d15f418628ef502e 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -72,6 +72,9 @@ int ext4_sync_file(struct file * file, struct dentry *dentry, int datasync) goto out; } + if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) + goto out; + /* * The VFS has written the file data. If the inode is unaltered * then we need not start a commit.