|
@@ -50,7 +50,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
|
|
{
|
|
{
|
|
struct inode *inode = dentry->d_inode;
|
|
struct inode *inode = dentry->d_inode;
|
|
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
|
|
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
|
|
- int ret = 0;
|
|
|
|
|
|
+ int err, ret = 0;
|
|
|
|
|
|
J_ASSERT(ext4_journal_current_handle() == NULL);
|
|
J_ASSERT(ext4_journal_current_handle() == NULL);
|
|
|
|
|
|
@@ -79,6 +79,9 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!journal)
|
|
|
|
+ ret = sync_mapping_buffers(inode->i_mapping);
|
|
|
|
+
|
|
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
|
|
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
@@ -91,7 +94,9 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
|
|
.sync_mode = WB_SYNC_ALL,
|
|
.sync_mode = WB_SYNC_ALL,
|
|
.nr_to_write = 0, /* sys_fsync did this */
|
|
.nr_to_write = 0, /* sys_fsync did this */
|
|
};
|
|
};
|
|
- ret = sync_inode(inode, &wbc);
|
|
|
|
|
|
+ err = sync_inode(inode, &wbc);
|
|
|
|
+ if (ret == 0)
|
|
|
|
+ ret = err;
|
|
}
|
|
}
|
|
out:
|
|
out:
|
|
if (journal && (journal->j_flags & JBD2_BARRIER))
|
|
if (journal && (journal->j_flags & JBD2_BARRIER))
|