Commit c75789fb authored by Goldwyn Rodrigues's avatar Goldwyn Rodrigues Committed by Jiri Slaby

ocfs2: remove filesize checks for sync I/O journal commit

commit 86b9c6f3 upstream.

Filesize is not a good indication that the file needs to be synced.
An example where this breaks is:
 1. Open the file in O_SYNC|O_RDWR
 2. Read a small portion of the file (say 64 bytes)
 3. Lseek to starting of the file
 4. Write 64 bytes

If the node crashes, it is not written out to disk because this was not
committed in the journal and the other node which reads the file after
recovery reads stale data (even if the write on the other node was
successful)
Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.de>
Reviewed-by: default avatarMark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 0deb7f8c
...@@ -2376,9 +2376,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, ...@@ -2376,9 +2376,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
if (ret < 0) if (ret < 0)
written = ret; written = ret;
if (!ret && ((old_size != i_size_read(inode)) || if (!ret) {
(old_clusters != OCFS2_I(inode)->ip_clusters) ||
has_refcount)) {
ret = jbd2_journal_force_commit(osb->journal->j_journal); ret = jbd2_journal_force_commit(osb->journal->j_journal);
if (ret < 0) if (ret < 0)
written = ret; written = ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment