aboutsummaryrefslogtreecommitdiff
path: root/fs/sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sync.c')
-rw-r--r--fs/sync.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/sync.c b/fs/sync.c
index e98d2608c..05a2cc8a1 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -197,6 +197,8 @@ SYSCALL_DEFINE1(syncfs, int, fd)
*/
int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync)
{
+ struct inode *inode = file->f_mapping->host;
+
#ifdef CONFIG_DYNAMIC_FSYNC
if (likely(dyn_fsync_active && !dyn_sync_scr_suspended))
return 0;
@@ -204,6 +206,12 @@ int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync)
#endif
if (!file->f_op || !file->f_op->fsync)
return -EINVAL;
+ if (!datasync && (inode->i_state & I_DIRTY_TIME)) {
+ spin_lock(&inode->i_lock);
+ inode->i_state &= ~I_DIRTY_TIME;
+ spin_unlock(&inode->i_lock);
+ mark_inode_dirty_sync(inode);
+ }
return file->f_op->fsync(file, start, end, datasync);
#ifdef CONFIG_DYNAMIC_FSYNC
}